@@ -3,13 +3,6 @@ using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using size_t = System.UIntPtr;
using TF_Graph = System.IntPtr;
using TF_Operation = System.IntPtr;
using TF_Status = System.IntPtr;
using TF_Session = System.IntPtr;
using TF_SessionOptions = System.IntPtr;
namespace Tensorflow
{
public static class c_api
@@ -25,31 +18,34 @@ namespace Tensorflow
public static unsafe extern void TF_AddInput(TF_OperationDescription desc, TF_Output input);
[DllImport(TensorFlowLibName)]
public static unsafe extern void TF_DeleteSessionOptions(TF_SessionOptions opts);
public static unsafe extern void TF_DeleteSessionOptions(IntPtr opts);
[DllImport(TensorFlowLibName)]
public static extern unsafe long TF_Dim(IntPtr tensor, int dim_index);
[DllImport(TensorFlowLibName)]
public static unsafe extern TF_Operation TF_FinishOperation(TF_OperationDescription desc, TF_Status status);
public static unsafe extern IntPtr TF_FinishOperation(TF_OperationDescription desc, IntPtr status);
[DllImport(TensorFlowLibName)]
public static extern string TF_GetBuffer(IntPtr buffer);
[DllImport(TensorFlowLibName)]
public static extern unsafe TF_Code TF_GetCode(TF_Status s);
public static extern unsafe TF_Code TF_GetCode(IntPtr s);
[DllImport(TensorFlowLibName)]
public static extern void TF_GraphGetOpDef(TF_Graph graph, string op_name, IntPtr output_op_def, TF_Status status);
public static extern void TF_GraphGetOpDef(IntPtr graph, string op_name, IntPtr output_op_def, IntPtr status);
[DllImport(TensorFlowLibName)]
public static extern unsafe string TF_Message(TF_Status s);
public static extern unsafe string TF_Message(IntPtr s);
[DllImport(TensorFlowLibName)]
public static unsafe extern TF_Graph TF_NewGraph();
public static unsafe extern IntPtr TF_NewGraph();
[DllImport(TensorFlowLibName)]
public static unsafe extern TF_OperationDescription TF_NewOperation(TF_Graph graph, string opType, string oper_name);
public static unsafe extern TF_OperationDescription TF_NewOperation(IntPtr graph, string opType, string oper_name);
[DllImport(TensorFlowLibName)]
public static unsafe extern TF_Status TF_NewStatus();
public static unsafe extern IntPtr TF_NewStatus();
/// <summary>
/// Return a new tensor that holds the bytes data[0,len-1]
@@ -63,16 +59,24 @@ namespace Tensorflow
/// <param name="deallocator_arg"></param>
/// <returns></returns>
[DllImport(TensorFlowLibName)]
public static extern unsafe IntPtr TF_NewTensor(TF_DataType dataType, long[] dims, int num_dims, IntPtr data, size_t len, tf.Deallocator deallocator, IntPtr deallocator_arg);
public static extern unsafe IntPtr TF_NewTensor(TF_DataType dataType, long[] dims, int num_dims, IntPtr data, UIntPtr len, tf.Deallocator deallocator, IntPtr deallocator_arg);
/// <summary>
/// Return the number of dimensions that the tensor has.
/// </summary>
/// <param name="tensor"></param>
/// <returns></returns>
[DllImport(TensorFlowLibName)]
public static extern unsafe int TF_NumDims(IntPtr tensor);
[DllImport(TensorFlowLibName)]
public static extern unsafe int TF_OperationNumOutputs(TF_Operation oper);
public static extern unsafe int TF_OperationNumOutputs(IntPtr oper);
[DllImport(TensorFlowLibName)]
public static extern unsafe void TF_SetAttrValueProto(TF_OperationDescription desc, string attr_name, IntPtr proto, size_t proto_len, TF_Status status);
public static extern unsafe void TF_SetAttrValueProto(TF_OperationDescription desc, string attr_name, IntPtr proto, UIntPtr proto_len, IntPtr status);
[DllImport(TensorFlowLibName)]
public static extern unsafe void TF_SetAttrTensor(TF_OperationDescription desc, string attr_name, TF_Tensor value, TF_Status status);
public static extern unsafe void TF_SetAttrTensor(TF_OperationDescription desc, string attr_name, IntPtr value, IntPtr status);
/// <summary>
///
@@ -90,12 +94,12 @@ namespace Tensorflow
/// <param name="run_metadata"></param>
/// <param name="status"></param>
[DllImport(TensorFlowLibName)]
public static extern unsafe void TF_SessionRun(TF_Session session, IntPtr run_options,
public static extern unsafe void TF_SessionRun(IntPtr session, IntPtr run_options,
TF_Output[] inputs, IntPtr[] input_values, int ninputs,
TF_Output[] outputs, IntPtr[] output_values, int noutputs,
TF_Operation [] target_opers, int ntargets,
IntPtr run_metadata,
TF_Status status);
IntPtr [] target_opers, int ntargets,
IntPtr run_metadata,
IntPtr status);
[DllImport(TensorFlowLibName)]
public static extern unsafe void TF_SetAttrType(TF_OperationDescription desc, string attr_name, TF_DataType value);
@@ -107,10 +111,10 @@ namespace Tensorflow
public static extern unsafe TF_DataType TF_TensorType(IntPtr tensor);
[DllImport(TensorFlowLibName)]
public static extern TF_Session TF_NewSession(TF_Graph graph, TF_SessionOptions opts, TF_Status status);
public static extern IntPtr TF_NewSession(IntPtr graph, IntPtr opts, IntPtr status);
[DllImport(TensorFlowLibName)]
public static extern TF_SessionOptions TF_NewSessionOptions();
public static extern IntPtr TF_NewSessionOptions();
[DllImport(TensorFlowLibName)]
public static unsafe extern IntPtr TF_Version();