@@ -26,18 +26,19 @@ public static Tensor tensor(double scalar, ScalarType? dtype = null, Device? dev
26
26
/// </summary>
27
27
public static Tensor tensor ( ( double Real , double Imaginary ) scalar , ScalarType ? dtype = null , Device ? device = null , bool requires_grad = false )
28
28
{
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 ) ;
33
30
}
34
31
35
32
/// <summary>
36
33
/// Create a scalar complex number tensor from independent real and imaginary components
37
34
/// </summary>
38
35
public static Tensor tensor ( double real , double imaginary , ScalarType ? dtype = null , Device ? device = null , bool requires_grad = false )
39
36
{
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 ) ;
41
42
}
42
43
43
44
/// <summary>
0 commit comments