@@ -14,7 +14,8 @@ public unsafe static T Scalar<T>(NDArray nd) where T : unmanaged
14
14
TF_DataType. TF_FLOAT => Scalar< T > ( * ( float * ) nd . data ) ,
15
15
TF_DataType. TF_INT32 => Scalar< T > ( * ( int * ) nd . data ) ,
16
16
TF_DataType. TF_INT64 => Scalar< T > ( * ( long * ) nd . data ) ,
17
- _ => throw new NotImplementedException ( "" )
17
+ TF_DataType. TF_DOUBLE => Scalar< T > ( * ( double * ) nd . data ) ,
18
+ _ => throw new NotImplementedException ( nameof ( NDArrayConverter ) )
18
19
} ;
19
20
20
21
static T Scalar< T > ( byte input )
@@ -23,7 +24,8 @@ static T Scalar<T>(byte input)
23
24
TypeCode . Byte => ( T ) Convert . ChangeType ( input , TypeCode . Byte ) ,
24
25
TypeCode . Int32 => ( T ) Convert . ChangeType ( input , TypeCode . Int32 ) ,
25
26
TypeCode . Single => ( T ) Convert . ChangeType ( input , TypeCode . Single ) ,
26
- _ => throw new NotImplementedException ( "" )
27
+ TypeCode . Double => ( T ) Convert . ChangeType ( input , TypeCode . Double ) ,
28
+ _ => throw new NotImplementedException ( nameof ( NDArrayConverter ) )
27
29
} ;
28
30
29
31
static T Scalar< T > ( float input )
@@ -32,7 +34,8 @@ static T Scalar<T>(float input)
32
34
TypeCode . Byte => ( T ) Convert . ChangeType ( input , TypeCode . Byte ) ,
33
35
TypeCode . Int32 => ( T ) Convert . ChangeType ( input , TypeCode . Int32 ) ,
34
36
TypeCode . Single => ( T ) Convert . ChangeType ( input , TypeCode . Single ) ,
35
- _ => throw new NotImplementedException ( "" )
37
+ TypeCode . Double => ( T ) Convert . ChangeType ( input , TypeCode . Double ) ,
38
+ _ => throw new NotImplementedException ( nameof ( NDArrayConverter ) )
36
39
} ;
37
40
38
41
static T Scalar< T > ( int input )
@@ -41,7 +44,8 @@ static T Scalar<T>(int input)
41
44
TypeCode . Byte => ( T ) Convert . ChangeType ( input , TypeCode . Byte ) ,
42
45
TypeCode . Int64 => ( T ) Convert . ChangeType ( input , TypeCode . Int64 ) ,
43
46
TypeCode . Single => ( T ) Convert . ChangeType ( input , TypeCode . Single ) ,
44
- _ => throw new NotImplementedException ( "" )
47
+ TypeCode . Double => ( T ) Convert . ChangeType ( input , TypeCode . Double ) ,
48
+ _ => throw new NotImplementedException ( nameof ( NDArrayConverter ) )
45
49
} ;
46
50
47
51
static T Scalar< T > ( long input )
@@ -50,7 +54,8 @@ static T Scalar<T>(long input)
50
54
TypeCode . Byte => ( T ) Convert . ChangeType ( input , TypeCode . Byte ) ,
51
55
TypeCode . Int32 => ( T ) Convert . ChangeType ( input , TypeCode . Int32 ) ,
52
56
TypeCode . Single => ( T ) Convert . ChangeType ( input , TypeCode . Single ) ,
53
- _ => throw new NotImplementedException ( "" )
57
+ TypeCode . Double => ( T ) Convert . ChangeType ( input , TypeCode . Double ) ,
58
+ _ => throw new NotImplementedException ( nameof ( NDArrayConverter ) )
54
59
} ;
55
60
56
61
public static unsafe Array ToMultiDimArray< T > ( NDArray nd ) where T : unmanaged
@@ -65,7 +70,7 @@ public static unsafe Array ToMultiDimArray<T>(NDArray nd) where T : unmanaged
65
70
T [ , , , ] array => Addr ( array ) ,
66
71
T [ , , , , ] array => Addr ( array ) ,
67
72
T [ , , , , , ] array => Addr ( array ) ,
68
- _ => throw new NotImplementedException ( "" )
73
+ _ => throw new NotImplementedException ( nameof ( NDArrayConverter ) )
69
74
} ;
70
75
71
76
System. Buffer . MemoryCopy ( nd . data . ToPointer ( ) , addr , nd . bytesize , nd . bytesize ) ;
0 commit comments