@@ -26,18 +26,19 @@ public static Tensor tensor(double scalar, ScalarType? dtype = null, Device? dev
2626 /// </summary>
2727 public static Tensor tensor ( ( double Real , double Imaginary ) scalar , ScalarType ? dtype = null , Device ? device = null , bool requires_grad = false )
2828 {
29- device = InitializeDevice ( device ) ;
30- var handle = THSTensor_newComplexFloat64Scalar ( scalar . Real , scalar . Imaginary , ( int ) device . type , device . index , requires_grad ) ;
31- if ( handle == IntPtr . Zero ) { CheckForErrors ( ) ; }
32- return InstantiateTensorWithLeakSafeTypeChange ( handle , dtype ) ;
29+ return tensor ( scalar . Real , scalar . Imaginary , dtype , device , requires_grad ) ;
3330 }
3431
3532 /// <summary>
3633 /// Create a scalar complex number tensor from independent real and imaginary components
3734 /// </summary>
3835 public static Tensor tensor ( double real , double imaginary , ScalarType ? dtype = null , Device ? device = null , bool requires_grad = false )
3936 {
40- return tensor ( ( real , imaginary ) , dtype , device , requires_grad ) ;
37+
38+ device = InitializeDevice ( device ) ;
39+ var handle = THSTensor_newComplexFloat64Scalar ( real , imaginary , ( int ) device . type , device . index , requires_grad ) ;
40+ if ( handle == IntPtr . Zero ) { CheckForErrors ( ) ; }
41+ return InstantiateTensorWithLeakSafeTypeChange ( handle , dtype ) ;
4142 }
4243
4344 /// <summary>
0 commit comments