@@ -656,14 +656,14 @@ def imrotate(src, rotation_degrees, zoom_in=False, zoom_out=False):
656656 # when a scalar is passed we wrap it into an array
657657 if isinstance (rotation_degrees , Number ):
658658 rotation_degrees = nd .array ([rotation_degrees ] * len (src ),
659- ctx = src .context )
659+ ctx = src .ctx )
660660
661661 if len (src ) != len (rotation_degrees ):
662662 raise ValueError (
663663 "The number of images must be equal to the number of rotation angles"
664664 )
665665
666- rotation_degrees = rotation_degrees .as_in_context (src .context )
666+ rotation_degrees = rotation_degrees .as_in_context (src .ctx )
667667 rotation_rad = np .pi * rotation_degrees / 180
668668 # reshape the rotations angle in order to be broadcasted
669669 # over the `src` tensor
@@ -674,10 +674,10 @@ def imrotate(src, rotation_degrees, zoom_in=False, zoom_out=False):
674674 hscale = (float (h - 1 ) / 2 )
675675 wscale = (float (w - 1 ) / 2 )
676676 h_matrix = (
677- nd .repeat (nd .arange (h , ctx = src .context ).astype ('float32' ).reshape (h , 1 ), w , axis = 1 ) - hscale
677+ nd .repeat (nd .arange (h , ctx = src .ctx ).astype ('float32' ).reshape (h , 1 ), w , axis = 1 ) - hscale
678678 ).expand_dims (axis = 0 )
679679 w_matrix = (
680- nd .repeat (nd .arange (w , ctx = src .context ).astype ('float32' ).reshape (1 , w ), h , axis = 0 ) - wscale
680+ nd .repeat (nd .arange (w , ctx = src .ctx ).astype ('float32' ).reshape (1 , w ), h , axis = 0 ) - wscale
681681 ).expand_dims (axis = 0 )
682682 # perform rotation on the grid
683683 c_alpha = nd .cos (rotation_rad )
@@ -689,7 +689,7 @@ def imrotate(src, rotation_degrees, zoom_in=False, zoom_out=False):
689689 w_matrix_rot = w_matrix_rot / wscale
690690 h_matrix_rot = h_matrix_rot / hscale
691691
692- h , w = nd .array ([h ], ctx = src .context ), nd .array ([w ], ctx = src .context )
692+ h , w = nd .array ([h ], ctx = src .ctx ), nd .array ([w ], ctx = src .ctx )
693693 # compute the scale factor in case `zoom_in` or `zoom_out` are True
694694 if zoom_in or zoom_out :
695695 rho_corner = nd .sqrt (h * h + w * w )
0 commit comments