| @@ -0,0 +1,10 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Text; | |||||
| namespace Tensorflow.Framework.Models | |||||
| { | |||||
| class ScopedTFFunction | |||||
| { | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,19 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Text; | |||||
| namespace Tensorflow.Framework.Models | |||||
| { | |||||
| public class ScopedTFGraph : Graph | |||||
| { | |||||
| public ScopedTFGraph() : base() | |||||
| { | |||||
| } | |||||
| ~ScopedTFGraph() | |||||
| { | |||||
| base.Dispose(); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,19 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Text; | |||||
| namespace Tensorflow.Framework.Models | |||||
| { | |||||
| public class ScopedTFImportGraphDefOptions : ImportGraphDefOptions | |||||
| { | |||||
| public ScopedTFImportGraphDefOptions() : base() | |||||
| { | |||||
| } | |||||
| ~ScopedTFImportGraphDefOptions() | |||||
| { | |||||
| base.Dispose(); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,24 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Text; | |||||
| namespace Tensorflow.Framework.Models | |||||
| { | |||||
| public class ScopedTFImportGraphDefResults : ImportGraphDefOptions | |||||
| { | |||||
| public ScopedTFImportGraphDefResults() : base() | |||||
| { | |||||
| } | |||||
| public ScopedTFImportGraphDefResults(IntPtr results) : base(results) | |||||
| { | |||||
| } | |||||
| ~ScopedTFImportGraphDefResults() | |||||
| { | |||||
| base.Dispose(); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,18 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Text; | |||||
| namespace Tensorflow.Framework.Models | |||||
| { | |||||
| public class ScopedTFStatus : Status | |||||
| { | |||||
| public ScopedTFStatus() : base() | |||||
| { | |||||
| } | |||||
| ~ScopedTFStatus() | |||||
| { | |||||
| base.Dispose(); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -6,6 +6,11 @@ namespace Tensorflow | |||||
| { | { | ||||
| public class Function | public class Function | ||||
| { | { | ||||
| private IntPtr _handle; | |||||
| public Function() | |||||
| { | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,13 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Runtime.InteropServices; | |||||
| using System.Text; | |||||
| namespace Tensorflow.Functions | |||||
| { | |||||
| [StructLayout(LayoutKind.Sequential)] | |||||
| public struct TF_Function | |||||
| { | |||||
| FunctionDef fdef; | |||||
| } | |||||
| } | |||||
| @@ -18,5 +18,7 @@ namespace Tensorflow | |||||
| /// <param name="status"></param> | /// <param name="status"></param> | ||||
| [DllImport(TensorFlowLibName)] | [DllImport(TensorFlowLibName)] | ||||
| public static extern void TF_FunctionToFunctionDef(IntPtr func, IntPtr output_func_def, IntPtr status); | public static extern void TF_FunctionToFunctionDef(IntPtr func, IntPtr output_func_def, IntPtr status); | ||||
| } | } | ||||
| } | } | ||||
| @@ -7,6 +7,7 @@ namespace Tensorflow | |||||
| public class ImportGraphDefOptions : IDisposable | public class ImportGraphDefOptions : IDisposable | ||||
| { | { | ||||
| private IntPtr _handle; | private IntPtr _handle; | ||||
| public int NumReturnOutputs => c_api.TF_ImportGraphDefOptionsNumReturnOutputs(_handle); | public int NumReturnOutputs => c_api.TF_ImportGraphDefOptionsNumReturnOutputs(_handle); | ||||
| public ImportGraphDefOptions() | public ImportGraphDefOptions() | ||||
| @@ -0,0 +1,62 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Text; | |||||
| namespace Tensorflow | |||||
| { | |||||
| public class StringOrFunction | |||||
| { | |||||
| private object variable; | |||||
| private StringOrFunction(object val) | |||||
| { | |||||
| variable = val; | |||||
| } | |||||
| public static implicit operator StringOrFunction(string val) | |||||
| { | |||||
| return new StringOrFunction(val); | |||||
| } | |||||
| public static implicit operator StringOrFunction(Function val) | |||||
| { | |||||
| return new StringOrFunction(val); | |||||
| } | |||||
| public bool IsFunction | |||||
| { | |||||
| get | |||||
| { | |||||
| return variable is FunctionDef; | |||||
| } | |||||
| } | |||||
| public override string ToString() | |||||
| { | |||||
| if (variable == null) | |||||
| return ""; | |||||
| if(!IsFunction) | |||||
| { | |||||
| return variable.ToString(); | |||||
| } | |||||
| return ((FunctionDef)variable).ToString(); | |||||
| } | |||||
| } | |||||
| public class _UserDeviceSpec | |||||
| { | |||||
| private StringOrFunction _device_name_or_function; | |||||
| private string display_name; | |||||
| private FunctionDef function; | |||||
| private string raw_string; | |||||
| public _UserDeviceSpec(StringOrFunction device_name_or_function) | |||||
| { | |||||
| _device_name_or_function = device_name_or_function; | |||||
| display_name = device_name_or_function.ToString(); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,13 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Runtime.InteropServices; | |||||
| using System.Text; | |||||
| namespace Tensorflow.Sessions | |||||
| { | |||||
| [StructLayout(LayoutKind.Sequential)] | |||||
| public struct TF_DeprecatedSession | |||||
| { | |||||
| Session session; | |||||
| } | |||||
| } | |||||
| @@ -8,6 +8,6 @@ namespace Tensorflow | |||||
| [StructLayout(LayoutKind.Sequential)] | [StructLayout(LayoutKind.Sequential)] | ||||
| public struct TF_SessionOptions | public struct TF_SessionOptions | ||||
| { | { | ||||
| public IntPtr options; | |||||
| public SessionOptions options; | |||||
| } | } | ||||
| } | } | ||||
| @@ -10,7 +10,7 @@ namespace Tensorflow | |||||
| /// </summary> | /// </summary> | ||||
| public class Status : IDisposable | public class Status : IDisposable | ||||
| { | { | ||||
| private readonly IntPtr _handle; | |||||
| protected readonly IntPtr _handle; | |||||
| /// <summary> | /// <summary> | ||||
| /// Error message | /// Error message | ||||
| @@ -14,6 +14,11 @@ namespace Tensorflow | |||||
| { | { | ||||
| public partial class ops | public partial class ops | ||||
| { | { | ||||
| public static int tensor_id(Tensor tensor) | |||||
| { | |||||
| return tensor.Id; | |||||
| } | |||||
| public static void add_to_collection<T>(string name, T value) | public static void add_to_collection<T>(string name, T value) | ||||
| { | { | ||||
| var graph = tf.get_default_graph(); | var graph = tf.get_default_graph(); | ||||