diff --git a/src/TensorFlowNET.Core/Framework/Models/ScopedTFFunction.cs b/src/TensorFlowNET.Core/Framework/Models/ScopedTFFunction.cs new file mode 100644 index 00000000..13e2b178 --- /dev/null +++ b/src/TensorFlowNET.Core/Framework/Models/ScopedTFFunction.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow.Framework.Models +{ + class ScopedTFFunction + { + } +} diff --git a/src/TensorFlowNET.Core/Framework/Models/ScopedTFGraph.cs b/src/TensorFlowNET.Core/Framework/Models/ScopedTFGraph.cs new file mode 100644 index 00000000..7433ecd2 --- /dev/null +++ b/src/TensorFlowNET.Core/Framework/Models/ScopedTFGraph.cs @@ -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(); + } + } +} diff --git a/src/TensorFlowNET.Core/Framework/Models/ScopedTFImportGraphDefOptions.cs b/src/TensorFlowNET.Core/Framework/Models/ScopedTFImportGraphDefOptions.cs new file mode 100644 index 00000000..2a3afe77 --- /dev/null +++ b/src/TensorFlowNET.Core/Framework/Models/ScopedTFImportGraphDefOptions.cs @@ -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(); + } + } +} diff --git a/src/TensorFlowNET.Core/Framework/Models/ScopedTFImportGraphDefResults.cs b/src/TensorFlowNET.Core/Framework/Models/ScopedTFImportGraphDefResults.cs new file mode 100644 index 00000000..55ebf08d --- /dev/null +++ b/src/TensorFlowNET.Core/Framework/Models/ScopedTFImportGraphDefResults.cs @@ -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(); + } + } +} diff --git a/src/TensorFlowNET.Core/Framework/Models/ScopedTFStatus.cs b/src/TensorFlowNET.Core/Framework/Models/ScopedTFStatus.cs new file mode 100644 index 00000000..8af11ffc --- /dev/null +++ b/src/TensorFlowNET.Core/Framework/Models/ScopedTFStatus.cs @@ -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(); + } + } +} diff --git a/src/TensorFlowNET.Core/Functions/Function.cs b/src/TensorFlowNET.Core/Functions/Function.cs index 93a0590f..f32464b8 100644 --- a/src/TensorFlowNET.Core/Functions/Function.cs +++ b/src/TensorFlowNET.Core/Functions/Function.cs @@ -6,6 +6,11 @@ namespace Tensorflow { public class Function { + private IntPtr _handle; + public Function() + { + + } } } diff --git a/src/TensorFlowNET.Core/Functions/TF_Function.cs b/src/TensorFlowNET.Core/Functions/TF_Function.cs new file mode 100644 index 00000000..03a442ef --- /dev/null +++ b/src/TensorFlowNET.Core/Functions/TF_Function.cs @@ -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; + } +} diff --git a/src/TensorFlowNET.Core/Functions/c_api.function.cs b/src/TensorFlowNET.Core/Functions/c_api.function.cs index cd4adfea..26a32470 100644 --- a/src/TensorFlowNET.Core/Functions/c_api.function.cs +++ b/src/TensorFlowNET.Core/Functions/c_api.function.cs @@ -18,5 +18,7 @@ namespace Tensorflow /// [DllImport(TensorFlowLibName)] public static extern void TF_FunctionToFunctionDef(IntPtr func, IntPtr output_func_def, IntPtr status); + + } } diff --git a/src/TensorFlowNET.Core/Graphs/ImportGraphDefOptions.cs b/src/TensorFlowNET.Core/Graphs/ImportGraphDefOptions.cs index 1e46885a..45bf2a4c 100644 --- a/src/TensorFlowNET.Core/Graphs/ImportGraphDefOptions.cs +++ b/src/TensorFlowNET.Core/Graphs/ImportGraphDefOptions.cs @@ -7,6 +7,7 @@ namespace Tensorflow public class ImportGraphDefOptions : IDisposable { private IntPtr _handle; + public int NumReturnOutputs => c_api.TF_ImportGraphDefOptionsNumReturnOutputs(_handle); public ImportGraphDefOptions() diff --git a/src/TensorFlowNET.Core/Operations/_UserDeviceSpec.cs b/src/TensorFlowNET.Core/Operations/_UserDeviceSpec.cs new file mode 100644 index 00000000..7a7cb72f --- /dev/null +++ b/src/TensorFlowNET.Core/Operations/_UserDeviceSpec.cs @@ -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(); + } + } +} diff --git a/src/TensorFlowNET.Core/Sessions/TF_DeprecatedSession.cs b/src/TensorFlowNET.Core/Sessions/TF_DeprecatedSession.cs new file mode 100644 index 00000000..5d483ea1 --- /dev/null +++ b/src/TensorFlowNET.Core/Sessions/TF_DeprecatedSession.cs @@ -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; + } +} diff --git a/src/TensorFlowNET.Core/Sessions/TF_SessionOptions.cs b/src/TensorFlowNET.Core/Sessions/TF_SessionOptions.cs index 8d8e1d6a..628d0ddc 100644 --- a/src/TensorFlowNET.Core/Sessions/TF_SessionOptions.cs +++ b/src/TensorFlowNET.Core/Sessions/TF_SessionOptions.cs @@ -8,6 +8,6 @@ namespace Tensorflow [StructLayout(LayoutKind.Sequential)] public struct TF_SessionOptions { - public IntPtr options; + public SessionOptions options; } } diff --git a/src/TensorFlowNET.Core/Status/Status.cs b/src/TensorFlowNET.Core/Status/Status.cs index c93304c7..e5d11f8a 100644 --- a/src/TensorFlowNET.Core/Status/Status.cs +++ b/src/TensorFlowNET.Core/Status/Status.cs @@ -10,7 +10,7 @@ namespace Tensorflow /// public class Status : IDisposable { - private readonly IntPtr _handle; + protected readonly IntPtr _handle; /// /// Error message diff --git a/src/TensorFlowNET.Core/ops.py.cs b/src/TensorFlowNET.Core/ops.py.cs index cb61a3ba..df389156 100644 --- a/src/TensorFlowNET.Core/ops.py.cs +++ b/src/TensorFlowNET.Core/ops.py.cs @@ -14,6 +14,11 @@ namespace Tensorflow { public partial class ops { + public static int tensor_id(Tensor tensor) + { + return tensor.Id; + } + public static void add_to_collection(string name, T value) { var graph = tf.get_default_graph();