@@ -14,7 +14,8 @@ public unsafe static T Scalar<T>(NDArray nd) where T : unmanaged
1414 TF_DataType. TF_FLOAT => Scalar< T > ( * ( float * ) nd . data ) ,
1515 TF_DataType. TF_INT32 => Scalar< T > ( * ( int * ) nd . data ) ,
1616 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 ) )
1819 } ;
1920
2021 static T Scalar< T > ( byte input )
@@ -23,7 +24,8 @@ static T Scalar<T>(byte input)
2324 TypeCode . Byte => ( T ) Convert . ChangeType ( input , TypeCode . Byte ) ,
2425 TypeCode . Int32 => ( T ) Convert . ChangeType ( input , TypeCode . Int32 ) ,
2526 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 ) )
2729 } ;
2830
2931 static T Scalar< T > ( float input )
@@ -32,7 +34,8 @@ static T Scalar<T>(float input)
3234 TypeCode . Byte => ( T ) Convert . ChangeType ( input , TypeCode . Byte ) ,
3335 TypeCode . Int32 => ( T ) Convert . ChangeType ( input , TypeCode . Int32 ) ,
3436 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 ) )
3639 } ;
3740
3841 static T Scalar< T > ( int input )
@@ -41,7 +44,8 @@ static T Scalar<T>(int input)
4144 TypeCode . Byte => ( T ) Convert . ChangeType ( input , TypeCode . Byte ) ,
4245 TypeCode . Int64 => ( T ) Convert . ChangeType ( input , TypeCode . Int64 ) ,
4346 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 ) )
4549 } ;
4650
4751 static T Scalar< T > ( long input )
@@ -50,7 +54,8 @@ static T Scalar<T>(long input)
5054 TypeCode . Byte => ( T ) Convert . ChangeType ( input , TypeCode . Byte ) ,
5155 TypeCode . Int32 => ( T ) Convert . ChangeType ( input , TypeCode . Int32 ) ,
5256 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 ) )
5459 } ;
5560
5661 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
6570 T [ , , , ] array => Addr ( array ) ,
6671 T [ , , , , ] array => Addr ( array ) ,
6772 T [ , , , , , ] array => Addr ( array ) ,
68- _ => throw new NotImplementedException ( "" )
73+ _ => throw new NotImplementedException ( nameof ( NDArrayConverter ) )
6974 } ;
7075
7176 System. Buffer . MemoryCopy ( nd . data . ToPointer ( ) , addr , nd . bytesize , nd . bytesize ) ;
0 commit comments