@@ -7,20 +7,23 @@ namespace Tensorflow
77{
88 public static partial class c_api
99 {
10+ [ DllImport ( TensorFlowLibName ) ]
11+ public static extern IntPtr TF_AllocateTensor ( TF_DataType dtype , long [ ] dims , int num_dims , ulong len ) ;
12+
1013 /// <summary>
1114 /// returns the sizeof() for the underlying type corresponding to the given TF_DataType enum value.
1215 /// </summary>
1316 /// <param name="dt"></param>
1417 /// <returns></returns>
1518 [ DllImport ( TensorFlowLibName ) ]
16- public static unsafe extern ulong TF_DataTypeSize ( TF_DataType dt ) ;
19+ public static extern ulong TF_DataTypeSize ( TF_DataType dt ) ;
1720
1821 /// <summary>
1922 /// Destroy a tensor.
2023 /// </summary>
2124 /// <param name="tensor"></param>
2225 [ DllImport ( TensorFlowLibName ) ]
23- public static unsafe extern void TF_DeleteTensor ( IntPtr tensor ) ;
26+ public static extern void TF_DeleteTensor ( IntPtr tensor ) ;
2427
2528 /// <summary>
2629 /// Return the length of the tensor in the "dim_index" dimension.
@@ -30,7 +33,7 @@ public static partial class c_api
3033 /// <param name="dim_index"></param>
3134 /// <returns></returns>
3235 [ DllImport ( TensorFlowLibName ) ]
33- public static extern unsafe long TF_Dim ( IntPtr tensor , int dim_index ) ;
36+ public static extern long TF_Dim ( IntPtr tensor , int dim_index ) ;
3437
3538 /// <summary>
3639 /// Return a new tensor that holds the bytes data[0,len-1]
@@ -44,38 +47,38 @@ public static partial class c_api
4447 /// <param name="deallocator_arg"></param>
4548 /// <returns></returns>
4649 [ DllImport ( TensorFlowLibName ) ]
47- public static extern unsafe IntPtr TF_NewTensor ( TF_DataType dataType , long [ ] dims , int num_dims , IntPtr data , UIntPtr len , Deallocator deallocator , ref bool deallocator_arg ) ;
50+ public static extern IntPtr TF_NewTensor ( TF_DataType dataType , long [ ] dims , int num_dims , IntPtr data , ulong len , Deallocator deallocator , ref bool deallocator_arg ) ;
4851
4952 /// <summary>
5053 /// Return the number of dimensions that the tensor has.
5154 /// </summary>
5255 /// <param name="tensor"></param>
5356 /// <returns></returns>
5457 [ DllImport ( TensorFlowLibName ) ]
55- public static extern unsafe int TF_NumDims ( IntPtr tensor ) ;
58+ public static extern int TF_NumDims ( IntPtr tensor ) ;
5659
5760 /// <summary>
5861 /// Return the size of the underlying data in bytes.
5962 /// </summary>
6063 /// <param name="tensor"></param>
6164 /// <returns></returns>
6265 [ DllImport ( TensorFlowLibName ) ]
63- public static extern unsafe ulong TF_TensorByteSize ( IntPtr tensor ) ;
66+ public static extern ulong TF_TensorByteSize ( IntPtr tensor ) ;
6467
6568 /// <summary>
6669 /// Return a pointer to the underlying data buffer.
6770 /// </summary>
6871 /// <param name="tensor"></param>
6972 /// <returns></returns>
7073 [ DllImport ( TensorFlowLibName ) ]
71- public static extern unsafe IntPtr TF_TensorData ( IntPtr tensor ) ;
74+ public static extern IntPtr TF_TensorData ( IntPtr tensor ) ;
7275
7376 /// <summary>
7477 /// Return the type of a tensor element.
7578 /// </summary>
7679 /// <param name="tensor"></param>
7780 /// <returns></returns>
7881 [ DllImport ( TensorFlowLibName ) ]
79- public static extern unsafe TF_DataType TF_TensorType ( IntPtr tensor ) ;
82+ public static extern TF_DataType TF_TensorType ( IntPtr tensor ) ;
8083 }
8184}
0 commit comments