@@ -794,7 +794,7 @@ def _to_tensorproxies(x: list, device: devices.DeviceType):
794794 lambda : f"Advanced indexing currently only supports zero or one-dimensional integer tensors, but found a tensor with dtype { x .dtype } and { x .ndim } dimensions" ,
795795 )
796796
797- utils .check (num_ellipses <= 1 , lambda : f "Found two or more ellipses in an advanced indexing key" )
797+ utils .check (num_ellipses <= 1 , lambda : "Found two or more ellipses in an advanced indexing key" )
798798
799799 # NOTE When the key has an ellipsis it can be longer than the number of dimensions in a
800800 # (in this case the ellipsis matches no dimensions)
@@ -808,7 +808,7 @@ def _to_tensorproxies(x: list, device: devices.DeviceType):
808808 has_ellipsis : bool = num_ellipses > 0
809809 utils .check (
810810 not has_ellipsis or key [0 ] is Ellipsis ,
811- lambda : f "Advanced indexing currently only supports ellipses as the first sequence element" ,
811+ lambda : "Advanced indexing currently only supports ellipses as the first sequence element" ,
812812 )
813813
814814 # The following models two advanced indexing cases:
@@ -1020,8 +1020,8 @@ def movedim(a: TensorLike, /, source: int | Sequence[int], destination: int | Se
10201020 # Verifies that dims are uniquely specified
10211021 # NOTE This must be done after canonicalization, since canonicalization resolves different ways of specifying the same dim
10221022 src_set = set (src )
1023- utils .check (len (src_set ) == len (src ), lambda : f "Found at least one source dimension specified multiple times" )
1024- utils .check (len (set (dst )) == len (dst ), lambda : f "Found at least one destination dimension specified multiple times" )
1023+ utils .check (len (src_set ) == len (src ), lambda : "Found at least one source dimension specified multiple times" )
1024+ utils .check (len (set (dst )) == len (dst ), lambda : "Found at least one destination dimension specified multiple times" )
10251025
10261026 # Constructs a permutation that moves the dimensions as requested
10271027 # NOTE Essentially move_dim specifies a partial permutation, where dimensions not explicitly specified as moving
@@ -1318,7 +1318,7 @@ def cat(tensors: list[TensorProxy], dim: int):
13181318def stack (tensors : list [TensorProxy ], dim : int ):
13191319 """Concatenates the given sequence of tensors in a new (the given) dimension."""
13201320 shapes = tuple (t .shape for t in tensors )
1321- utils .check (shapes , lambda : f "list of tensors cannot be empty" )
1321+ utils .check (shapes , lambda : "list of tensors cannot be empty" )
13221322 for i , s in enumerate (shapes [1 :], start = 1 ):
13231323 utils .check (
13241324 s == shapes [0 ], lambda : f"tensors must be of the same shape, tensor at { i } is { s } instead of { shapes [0 ]} "
@@ -1388,7 +1388,7 @@ def matrix_transpose(a: TensorProxy) -> TensorProxy:
13881388 mT_scalar_warning ()
13891389 return a
13901390 elif a .ndim == 1 :
1391- raise RuntimeError (f "tensor.mT is only supported on matrices or batches of matrices. Got 1-D tensor." )
1391+ raise RuntimeError ("tensor.mT is only supported on matrices or batches of matrices. Got 1-D tensor." )
13921392
13931393 dim0 , dim1 = - 2 , - 1
13941394 dim0 , dim1 = utils .canonicalize_dims (a .ndim , (dim0 , dim1 ))
@@ -1805,7 +1805,7 @@ def real(a: TensorProxy | Number):
18051805def imag (a : TensorProxy | Number , / ) -> TensorLike :
18061806 utils .check (
18071807 dtypes .is_complex_dtype (dtypes .to_dtype (a )),
1808- lambda : f "imag is not implemented for tensors with non-complex dtypes" ,
1808+ lambda : "imag is not implemented for tensors with non-complex dtypes" ,
18091809 )
18101810
18111811 return _elementwise_unary_wrapper (
@@ -1874,7 +1874,7 @@ def bitwise_xor(a, b):
18741874def copysign (a , b ):
18751875 utils .check (
18761876 not dtypes .is_complex_dtype (dtypes .to_dtype (a )) and not dtypes .is_complex_dtype (dtypes .to_dtype (b )),
1877- lambda : f "copysign is not defined for complex dtypes" ,
1877+ lambda : "copysign is not defined for complex dtypes" ,
18781878 )
18791879
18801880 computation_dtype , result_dtype = utils .elementwise_type_promotion (
@@ -1968,7 +1968,7 @@ def floor_divide(a: TensorProxy | Number, b: TensorProxy | Number) -> TensorProx
19681968 a , b , type_promotion_kind = utils .ELEMENTWISE_TYPE_PROMOTION_KIND .DEFAULT
19691969 )
19701970
1971- utils .check (not dtypes .is_complex_dtype (computation_dtype ), lambda : f "Complex floor division is not supported" )
1971+ utils .check (not dtypes .is_complex_dtype (computation_dtype ), lambda : "Complex floor division is not supported" )
19721972
19731973 if dtypes .is_float_dtype (computation_dtype ):
19741974 return _floor_divide_float (a , b )
0 commit comments