diff --git a/src/TensorFlowNET.Core/APIs/tf.nn.cs b/src/TensorFlowNET.Core/APIs/tf.nn.cs index 1c88d1e9..e5ecb908 100644 --- a/src/TensorFlowNET.Core/APIs/tf.nn.cs +++ b/src/TensorFlowNET.Core/APIs/tf.nn.cs @@ -16,7 +16,7 @@ using Tensorflow.Operations; using Tensorflow.Operations.Activation; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { @@ -141,7 +141,7 @@ namespace Tensorflow public Tensor bias_add(Tensor value, RefVariable bias, string data_format = null, string name = null) { - return Python.tf_with(ops.name_scope(name, "BiasAdd", new { value, bias }), scope => + return tf_with(ops.name_scope(name, "BiasAdd", new { value, bias }), scope => { name = scope; return gen_nn_ops.bias_add(value, bias, data_format: data_format, name: name); diff --git a/src/TensorFlowNET.Core/Python.cs b/src/TensorFlowNET.Core/Binding.Util.cs similarity index 90% rename from src/TensorFlowNET.Core/Python.cs rename to src/TensorFlowNET.Core/Binding.Util.cs index b5240cf4..da2cdf6e 100644 --- a/src/TensorFlowNET.Core/Python.cs +++ b/src/TensorFlowNET.Core/Binding.Util.cs @@ -15,7 +15,6 @@ ******************************************************************************/ using NumSharp; -using NumSharp.Backends; using System; using System.Collections; using System.Collections.Generic; @@ -26,18 +25,15 @@ using System.Linq; namespace Tensorflow { /// - /// Mapping C# functions to Python + /// Binding utilities to mimic python functions. /// - public static class Python + public static partial class Binding { public static void print(object obj) { Console.WriteLine(obj.ToString()); } - //protected int len(IEnumerable a) - // => a.Count(); - public static int len(object a) { switch (a) @@ -66,15 +62,15 @@ namespace Tensorflow return Enumerable.Range(start, end - start); } - public static T New() where T : IPyClass, new() + public static T New() where T : IObjectLife, new() { var instance = new T(); - instance.__init__(instance); + instance.__init__(); return instance; } [DebuggerNonUserCode()] // with "Just My Code" enabled this lets the debugger break at the origin of the exception - public static void tf_with(IPython py, Action action) + public static void tf_with(IObjectLife py, Action action) { try { @@ -94,7 +90,7 @@ namespace Tensorflow } [DebuggerNonUserCode()] // with "Just My Code" enabled this lets the debugger break at the origin of the exception - public static void tf_with(T py, Action action) where T : IPython + public static void tf_with(T py, Action action) where T : IObjectLife { try { @@ -114,7 +110,7 @@ namespace Tensorflow } [DebuggerNonUserCode()] // with "Just My Code" enabled this lets the debugger break at the origin of the exception - public static TOut tf_with(TIn py, Func action) where TIn : IPython + public static TOut tf_with(TIn py, Func action) where TIn : IObjectLife { try { @@ -124,7 +120,6 @@ namespace Tensorflow catch (Exception ex) { Console.WriteLine(ex.ToString()); - throw; return default(TOut); } finally @@ -276,7 +271,9 @@ namespace Tensorflow var __memberobject__ = __type__.GetMember(key); return (__memberobject__.Length > 0) ? true : false; } + public delegate object __object__(params object[] args); + public static __object__ getattr(object obj, string key, params Type[] ___parameter_type__) { var __dyn_obj__ = obj.GetType().GetMember(key); @@ -288,7 +285,7 @@ namespace Tensorflow try { var __method__ = (___parameter_type__.Length > 0) ? obj.GetType().GetMethod(key, ___parameter_type__) : obj.GetType().GetMethod(key); - return (__object__)((object[] args) => __method__.Invoke(obj, args)); + return (object[] args) => __method__.Invoke(obj, args); } catch (System.Reflection.AmbiguousMatchException ex) { @@ -297,16 +294,17 @@ namespace Tensorflow } else if (__type__.MemberType == System.Reflection.MemberTypes.Field) { - var __field__ = (object)obj.GetType().GetField(key).GetValue(obj); - return (__object__)((object[] args) => { return __field__; }); + var __field__ = obj.GetType().GetField(key).GetValue(obj); + return (object[] args) => { return __field__; }; } else if (__type__.MemberType == System.Reflection.MemberTypes.Property) { - var __property__ = (object)obj.GetType().GetProperty(key).GetValue(obj); - return (__object__)((object[] args) => { return __property__; }); + var __property__ = obj.GetType().GetProperty(key).GetValue(obj); + return (object[] args) => { return __property__; }; } - return (__object__)((object[] args) => { return "NaN"; }); + return (object[] args) => { return "NaN"; }; } + public static IEnumerable TupleToEnumerable(object tuple) { Type t = tuple.GetType(); @@ -315,7 +313,7 @@ namespace Tensorflow var flds = t.GetFields(); for(int i = 0; i < flds.Length;i++) { - yield return ((object)flds[i].GetValue(tuple)); + yield return flds[i].GetValue(tuple); } } else @@ -323,10 +321,12 @@ namespace Tensorflow throw new System.Exception("Expected Tuple."); } } + public static bool isinstance(object Item1, Type Item2) { - return (Item1.GetType() == Item2); + return Item1.GetType() == Item2; } + public static bool isinstance(object Item1, object tuple) { var tup = TupleToEnumerable(tuple); @@ -338,11 +338,4 @@ namespace Tensorflow return false; } } - - public interface IPython : IDisposable - { - void __enter__(); - - void __exit__(); - } } diff --git a/src/TensorFlowNET.Core/Binding.cs b/src/TensorFlowNET.Core/Binding.cs index 8f2de0eb..f443f2eb 100644 --- a/src/TensorFlowNET.Core/Binding.cs +++ b/src/TensorFlowNET.Core/Binding.cs @@ -4,8 +4,8 @@ using System.Text; namespace Tensorflow { - public static class Binding + public static partial class Binding { - public static tensorflow tf { get; } = Python.New(); + public static tensorflow tf { get; } = New(); } } diff --git a/src/TensorFlowNET.Core/Clustering/_InitializeClustersOpFactory.cs b/src/TensorFlowNET.Core/Clustering/_InitializeClustersOpFactory.cs index 8112708f..2e86a5ea 100644 --- a/src/TensorFlowNET.Core/Clustering/_InitializeClustersOpFactory.cs +++ b/src/TensorFlowNET.Core/Clustering/_InitializeClustersOpFactory.cs @@ -15,7 +15,7 @@ ******************************************************************************/ using System.Linq; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow.Clustering { diff --git a/src/TensorFlowNET.Core/Framework/graph_util_impl.cs b/src/TensorFlowNET.Core/Framework/graph_util_impl.cs index f9514173..280ee8b9 100644 --- a/src/TensorFlowNET.Core/Framework/graph_util_impl.cs +++ b/src/TensorFlowNET.Core/Framework/graph_util_impl.cs @@ -18,7 +18,7 @@ using NumSharp; using System; using System.Collections.Generic; using System.Linq; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Framework/importer.py.cs b/src/TensorFlowNET.Core/Framework/importer.py.cs index 254fda19..b6c011c4 100644 --- a/src/TensorFlowNET.Core/Framework/importer.py.cs +++ b/src/TensorFlowNET.Core/Framework/importer.py.cs @@ -19,7 +19,7 @@ using System; using System.Collections.Generic; using System.Linq; using static Tensorflow.OpDef.Types; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Gradients/array_grad.cs b/src/TensorFlowNET.Core/Gradients/array_grad.cs index a6eede7c..e98ec21e 100644 --- a/src/TensorFlowNET.Core/Gradients/array_grad.cs +++ b/src/TensorFlowNET.Core/Gradients/array_grad.cs @@ -17,7 +17,6 @@ using System.Collections.Generic; using System.Linq; using Tensorflow.Framework; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace Tensorflow.Gradients diff --git a/src/TensorFlowNET.Core/Gradients/gradients_util.cs b/src/TensorFlowNET.Core/Gradients/gradients_util.cs index 43247fa4..3b6d0eea 100644 --- a/src/TensorFlowNET.Core/Gradients/gradients_util.cs +++ b/src/TensorFlowNET.Core/Gradients/gradients_util.cs @@ -17,7 +17,7 @@ using System; using System.Collections.Generic; using System.Linq; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Gradients/math_grad.cs b/src/TensorFlowNET.Core/Gradients/math_grad.cs index a7fdcba5..672270b9 100644 --- a/src/TensorFlowNET.Core/Gradients/math_grad.cs +++ b/src/TensorFlowNET.Core/Gradients/math_grad.cs @@ -17,7 +17,6 @@ using System; using System.Linq; using Tensorflow.Operations; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace Tensorflow.Gradients diff --git a/src/TensorFlowNET.Core/Graphs/Graph.cs b/src/TensorFlowNET.Core/Graphs/Graph.cs index 6656862f..77926dca 100644 --- a/src/TensorFlowNET.Core/Graphs/Graph.cs +++ b/src/TensorFlowNET.Core/Graphs/Graph.cs @@ -19,6 +19,7 @@ using System.Collections; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; +using static Tensorflow.Binding; namespace Tensorflow { @@ -247,7 +248,7 @@ namespace Tensorflow if (inputs == null) inputs = new Tensor[0]; - foreach ((int idx, Tensor a) in Python.enumerate(inputs)) + foreach ((int idx, Tensor a) in enumerate(inputs)) { } diff --git a/src/TensorFlowNET.Core/Graphs/_ControlDependenciesController.cs b/src/TensorFlowNET.Core/Graphs/_ControlDependenciesController.cs index 900a77ec..6a75c982 100644 --- a/src/TensorFlowNET.Core/Graphs/_ControlDependenciesController.cs +++ b/src/TensorFlowNET.Core/Graphs/_ControlDependenciesController.cs @@ -22,7 +22,7 @@ namespace Tensorflow /// /// Context manager for `control_dependencies()` /// - public class _ControlDependenciesController : IPython + public class _ControlDependenciesController : IObjectLife { private Graph _graph; private List _control_inputs_val; @@ -110,6 +110,16 @@ namespace Tensorflow public void Dispose() { - } + } + + public void __init__() + { + + } + + public void __del__() + { + + } } } diff --git a/src/TensorFlowNET.Core/IPyClass.cs b/src/TensorFlowNET.Core/IObjectLife.cs similarity index 84% rename from src/TensorFlowNET.Core/IPyClass.cs rename to src/TensorFlowNET.Core/IObjectLife.cs index 47190a7d..a3978cc2 100644 --- a/src/TensorFlowNET.Core/IPyClass.cs +++ b/src/TensorFlowNET.Core/IObjectLife.cs @@ -14,20 +14,22 @@ limitations under the License. ******************************************************************************/ +using System; + namespace Tensorflow { - public interface IPyClass + public interface IObjectLife : IDisposable { /// /// Called when the instance is created. /// /// - void __init__(IPyClass self); + void __init__(); - void __enter__(IPyClass self); + void __enter__(); - void __exit__(IPyClass self); + void __exit__(); - void __del__(IPyClass self); + void __del__(); } } diff --git a/src/TensorFlowNET.Core/Keras/BackendBase.cs b/src/TensorFlowNET.Core/Keras/BackendBase.cs index 50263957..a53db62e 100644 --- a/src/TensorFlowNET.Core/Keras/BackendBase.cs +++ b/src/TensorFlowNET.Core/Keras/BackendBase.cs @@ -15,7 +15,7 @@ ******************************************************************************/ using System; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow.Keras { diff --git a/src/TensorFlowNET.Core/Keras/Engine/Sequential.cs b/src/TensorFlowNET.Core/Keras/Engine/Sequential.cs index 651961b4..e18b401c 100644 --- a/src/TensorFlowNET.Core/Keras/Engine/Sequential.cs +++ b/src/TensorFlowNET.Core/Keras/Engine/Sequential.cs @@ -18,7 +18,7 @@ using Tensorflow.Keras.Layers; namespace Tensorflow.Keras.Engine { - public class Sequential : Model, IPython + public class Sequential : Model, IObjectLife { public Sequential(string name = null) : base(name: name) @@ -69,5 +69,15 @@ namespace Tensorflow.Keras.Engine { } + + public void __init__() + { + + } + + public void __del__() + { + + } } } diff --git a/src/TensorFlowNET.Core/Keras/Layers/BatchNormalization.cs b/src/TensorFlowNET.Core/Keras/Layers/BatchNormalization.cs index 51230aab..929b3a3f 100644 --- a/src/TensorFlowNET.Core/Keras/Layers/BatchNormalization.cs +++ b/src/TensorFlowNET.Core/Keras/Layers/BatchNormalization.cs @@ -83,7 +83,7 @@ namespace Tensorflow.Keras.Layers protected override void build(TensorShape input_shape) { var ndims = input_shape.ndim; - foreach (var (idx, x) in Python.enumerate(axis)) + foreach (var (idx, x) in enumerate(axis)) if (x < 0) axis[idx] = ndims + x; @@ -208,7 +208,7 @@ namespace Tensorflow.Keras.Layers public Tensor _assign_moving_average(RefVariable variable, Tensor value, Tensor momentum) { - return Python.tf_with(ops.name_scope(null, "AssignMovingAvg", new { variable, value, momentum }), scope => + return tf_with(ops.name_scope(null, "AssignMovingAvg", new { variable, value, momentum }), scope => { // var cm = ops.colocate_with(variable); var decay = ops.convert_to_tensor(1.0f - momentum, name: "decay"); diff --git a/src/TensorFlowNET.Core/Keras/Layers/Layer.cs b/src/TensorFlowNET.Core/Keras/Layers/Layer.cs index 24bda725..6681ec56 100644 --- a/src/TensorFlowNET.Core/Keras/Layers/Layer.cs +++ b/src/TensorFlowNET.Core/Keras/Layers/Layer.cs @@ -20,7 +20,6 @@ using System.Linq; using Tensorflow.Keras.Engine; using Tensorflow.Keras.Utils; using Tensorflow.Train; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace Tensorflow.Keras.Layers diff --git a/src/TensorFlowNET.Core/Keras/backend.cs b/src/TensorFlowNET.Core/Keras/backend.cs index 1161f07b..5ac04f1a 100644 --- a/src/TensorFlowNET.Core/Keras/backend.cs +++ b/src/TensorFlowNET.Core/Keras/backend.cs @@ -16,7 +16,6 @@ using System; using System.Collections.Generic; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace Tensorflow.Keras diff --git a/src/TensorFlowNET.Core/Layers/Layer.cs b/src/TensorFlowNET.Core/Layers/Layer.cs index 5bbafe14..304e7f7b 100644 --- a/src/TensorFlowNET.Core/Layers/Layer.cs +++ b/src/TensorFlowNET.Core/Layers/Layer.cs @@ -16,7 +16,6 @@ using System; using System.Collections.Generic; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace Tensorflow.Layers diff --git a/src/TensorFlowNET.Core/Operations/ControlFlows/CondContext.cs b/src/TensorFlowNET.Core/Operations/ControlFlows/CondContext.cs index 136c9e3b..b1503567 100644 --- a/src/TensorFlowNET.Core/Operations/ControlFlows/CondContext.cs +++ b/src/TensorFlowNET.Core/Operations/ControlFlows/CondContext.cs @@ -18,7 +18,7 @@ using System; using System.Collections.Generic; using System.Linq; using Tensorflow.Operations.ControlFlows; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow.Operations { diff --git a/src/TensorFlowNET.Core/Operations/ControlFlows/ControlFlowContext.cs b/src/TensorFlowNET.Core/Operations/ControlFlows/ControlFlowContext.cs index 5cfecc49..2c05e36a 100644 --- a/src/TensorFlowNET.Core/Operations/ControlFlows/ControlFlowContext.cs +++ b/src/TensorFlowNET.Core/Operations/ControlFlows/ControlFlowContext.cs @@ -39,7 +39,7 @@ namespace Tensorflow.Operations /// 4. A ControlFlowContext has _context_stack. /// Pushed and popped by ctxt.Enter() and ctxt.Exit() /// - public abstract class ControlFlowContext : IPython + public abstract class ControlFlowContext : IObjectLife { /// /// The predicate tensor in this branch @@ -265,5 +265,14 @@ namespace Tensorflow.Operations { } + public void __init__() + { + + } + + public void __del__() + { + + } } } diff --git a/src/TensorFlowNET.Core/Operations/ControlFlows/WhileContext.cs b/src/TensorFlowNET.Core/Operations/ControlFlows/WhileContext.cs index c5e7121c..ccd88480 100644 --- a/src/TensorFlowNET.Core/Operations/ControlFlows/WhileContext.cs +++ b/src/TensorFlowNET.Core/Operations/ControlFlows/WhileContext.cs @@ -19,8 +19,8 @@ using System.Collections.Generic; using System.Linq; using Tensorflow.Operations.ControlFlows; using Tensorflow.Util; -using static Tensorflow.Python; using static Tensorflow.control_flow_ops; +using static Tensorflow.Binding; namespace Tensorflow.Operations { diff --git a/src/TensorFlowNET.Core/Operations/Distributions/distribution.py.cs b/src/TensorFlowNET.Core/Operations/Distributions/distribution.py.cs index 69affeea..16be7bfb 100644 --- a/src/TensorFlowNET.Core/Operations/Distributions/distribution.py.cs +++ b/src/TensorFlowNET.Core/Operations/Distributions/distribution.py.cs @@ -17,7 +17,7 @@ //Base classes for probability distributions. using System; using System.Collections.Generic; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow diff --git a/src/TensorFlowNET.Core/Operations/Distributions/normal.py.cs b/src/TensorFlowNET.Core/Operations/Distributions/normal.py.cs index c3c5d4d4..c7483f96 100644 --- a/src/TensorFlowNET.Core/Operations/Distributions/normal.py.cs +++ b/src/TensorFlowNET.Core/Operations/Distributions/normal.py.cs @@ -16,7 +16,6 @@ using System; using System.Collections.Generic; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace Tensorflow diff --git a/src/TensorFlowNET.Core/Operations/Losses/losses_impl.py.cs b/src/TensorFlowNET.Core/Operations/Losses/losses_impl.py.cs index c5a6ad22..de4bf964 100644 --- a/src/TensorFlowNET.Core/Operations/Losses/losses_impl.py.cs +++ b/src/TensorFlowNET.Core/Operations/Losses/losses_impl.py.cs @@ -15,7 +15,7 @@ ******************************************************************************/ using System; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Operations/NnOps/MaxPoolFunction.cs b/src/TensorFlowNET.Core/Operations/NnOps/MaxPoolFunction.cs index b385f9c8..e28557c7 100644 --- a/src/TensorFlowNET.Core/Operations/NnOps/MaxPoolFunction.cs +++ b/src/TensorFlowNET.Core/Operations/NnOps/MaxPoolFunction.cs @@ -14,7 +14,7 @@ limitations under the License. ******************************************************************************/ -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow.Operations { diff --git a/src/TensorFlowNET.Core/Operations/NnOps/rnn.cs b/src/TensorFlowNET.Core/Operations/NnOps/rnn.cs index 32d92179..3198942b 100644 --- a/src/TensorFlowNET.Core/Operations/NnOps/rnn.cs +++ b/src/TensorFlowNET.Core/Operations/NnOps/rnn.cs @@ -17,7 +17,6 @@ using System; using System.Collections.Generic; using System.Linq; -using static Tensorflow.Python; using Tensorflow.Util; using static Tensorflow.Binding; diff --git a/src/TensorFlowNET.Core/Operations/OpDefLibrary.cs b/src/TensorFlowNET.Core/Operations/OpDefLibrary.cs index 0b41e811..e6799f61 100644 --- a/src/TensorFlowNET.Core/Operations/OpDefLibrary.cs +++ b/src/TensorFlowNET.Core/Operations/OpDefLibrary.cs @@ -18,7 +18,7 @@ using System; using System.Collections.Generic; using System.Linq; using static Tensorflow.OpDef.Types; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Operations/RNNCell.cs b/src/TensorFlowNET.Core/Operations/RNNCell.cs index 1b260981..442115c0 100644 --- a/src/TensorFlowNET.Core/Operations/RNNCell.cs +++ b/src/TensorFlowNET.Core/Operations/RNNCell.cs @@ -17,7 +17,7 @@ using System; using Tensorflow.Operations; using Tensorflow.Util; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Operations/_GraphTensorArray.cs b/src/TensorFlowNET.Core/Operations/_GraphTensorArray.cs index bbeee929..4c700a5f 100644 --- a/src/TensorFlowNET.Core/Operations/_GraphTensorArray.cs +++ b/src/TensorFlowNET.Core/Operations/_GraphTensorArray.cs @@ -17,7 +17,7 @@ using System; using System.Collections.Generic; using System.Text; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow.Operations { diff --git a/src/TensorFlowNET.Core/Operations/array_ops.py.cs b/src/TensorFlowNET.Core/Operations/array_ops.py.cs index fc02ba73..d3213250 100644 --- a/src/TensorFlowNET.Core/Operations/array_ops.py.cs +++ b/src/TensorFlowNET.Core/Operations/array_ops.py.cs @@ -17,7 +17,6 @@ using NumSharp; using System; using System.Collections.Generic; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace Tensorflow diff --git a/src/TensorFlowNET.Core/Operations/check_ops.cs b/src/TensorFlowNET.Core/Operations/check_ops.cs index 06b648b6..8b670640 100644 --- a/src/TensorFlowNET.Core/Operations/check_ops.cs +++ b/src/TensorFlowNET.Core/Operations/check_ops.cs @@ -14,7 +14,7 @@ limitations under the License. ******************************************************************************/ -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Operations/confusion_matrix.py.cs b/src/TensorFlowNET.Core/Operations/confusion_matrix.py.cs index b2790de0..b48139e0 100644 --- a/src/TensorFlowNET.Core/Operations/confusion_matrix.py.cs +++ b/src/TensorFlowNET.Core/Operations/confusion_matrix.py.cs @@ -15,7 +15,7 @@ ******************************************************************************/ using System; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Operations/control_flow_ops.py.cs b/src/TensorFlowNET.Core/Operations/control_flow_ops.py.cs index c8c711e7..04595256 100644 --- a/src/TensorFlowNET.Core/Operations/control_flow_ops.py.cs +++ b/src/TensorFlowNET.Core/Operations/control_flow_ops.py.cs @@ -20,7 +20,7 @@ using System.Linq; using Tensorflow.Operations; using Tensorflow.Operations.ControlFlows; using util = Tensorflow.control_flow_util; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Operations/embedding_ops.cs b/src/TensorFlowNET.Core/Operations/embedding_ops.cs index 23864329..3c02e825 100644 --- a/src/TensorFlowNET.Core/Operations/embedding_ops.cs +++ b/src/TensorFlowNET.Core/Operations/embedding_ops.cs @@ -15,7 +15,7 @@ ******************************************************************************/ using System; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Operations/gen_image_ops.py.cs b/src/TensorFlowNET.Core/Operations/gen_image_ops.py.cs index 507a1d3e..baaf4fbe 100644 --- a/src/TensorFlowNET.Core/Operations/gen_image_ops.py.cs +++ b/src/TensorFlowNET.Core/Operations/gen_image_ops.py.cs @@ -15,7 +15,6 @@ ******************************************************************************/ using System; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace Tensorflow diff --git a/src/TensorFlowNET.Core/Operations/math_ops.cs b/src/TensorFlowNET.Core/Operations/math_ops.cs index 1e2363e4..fa1fda12 100644 --- a/src/TensorFlowNET.Core/Operations/math_ops.cs +++ b/src/TensorFlowNET.Core/Operations/math_ops.cs @@ -18,7 +18,7 @@ using NumSharp; using System; using System.Collections.Generic; using Tensorflow.Framework; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Operations/nn_impl.py.cs b/src/TensorFlowNET.Core/Operations/nn_impl.py.cs index 84fb5486..bd70c10a 100644 --- a/src/TensorFlowNET.Core/Operations/nn_impl.py.cs +++ b/src/TensorFlowNET.Core/Operations/nn_impl.py.cs @@ -15,7 +15,7 @@ ******************************************************************************/ using Tensorflow.Operations; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Operations/nn_ops.cs b/src/TensorFlowNET.Core/Operations/nn_ops.cs index 1a63dc20..cbf55861 100644 --- a/src/TensorFlowNET.Core/Operations/nn_ops.cs +++ b/src/TensorFlowNET.Core/Operations/nn_ops.cs @@ -17,7 +17,7 @@ using System; using System.Linq; using Tensorflow.Operations; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { @@ -50,7 +50,7 @@ namespace Tensorflow string data_format = null, string name = null) { - return Python.tf_with(ops.name_scope(name, "BiasAdd", new { value, bias }), scope => + return tf_with(ops.name_scope(name, "BiasAdd", new { value, bias }), scope => { name = scope; value = ops.convert_to_tensor(value, name: "input"); diff --git a/src/TensorFlowNET.Core/Operations/random_ops.py.cs b/src/TensorFlowNET.Core/Operations/random_ops.py.cs index 3232c917..9ca4db88 100644 --- a/src/TensorFlowNET.Core/Operations/random_ops.py.cs +++ b/src/TensorFlowNET.Core/Operations/random_ops.py.cs @@ -14,7 +14,7 @@ limitations under the License. ******************************************************************************/ -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Operations/weights_broadcast_ops.cs b/src/TensorFlowNET.Core/Operations/weights_broadcast_ops.cs index d8bfcbac..8895c147 100644 --- a/src/TensorFlowNET.Core/Operations/weights_broadcast_ops.cs +++ b/src/TensorFlowNET.Core/Operations/weights_broadcast_ops.cs @@ -14,7 +14,7 @@ limitations under the License. ******************************************************************************/ -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Sessions/Session.cs b/src/TensorFlowNET.Core/Sessions/Session.cs index 79c469a2..ec2e443f 100644 --- a/src/TensorFlowNET.Core/Sessions/Session.cs +++ b/src/TensorFlowNET.Core/Sessions/Session.cs @@ -19,7 +19,7 @@ using static Tensorflow.Binding; namespace Tensorflow { - public class Session : BaseSession, IPython + public class Session : BaseSession, IObjectLife { public Session(string target = "", Graph g = null) : base(target, g, null) @@ -85,5 +85,15 @@ namespace Tensorflow { } + + public void __init__() + { + + } + + public void __del__() + { + + } } } diff --git a/src/TensorFlowNET.Core/Summaries/Summary.cs b/src/TensorFlowNET.Core/Summaries/Summary.cs index 258edf88..2bea0ddc 100644 --- a/src/TensorFlowNET.Core/Summaries/Summary.cs +++ b/src/TensorFlowNET.Core/Summaries/Summary.cs @@ -16,7 +16,7 @@ using System.Collections.Generic; using System.Linq; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow.Summaries { diff --git a/src/TensorFlowNET.Core/Tensors/Tensor.Operators.cs b/src/TensorFlowNET.Core/Tensors/Tensor.Operators.cs index 4bd32d74..eb912eb9 100644 --- a/src/TensorFlowNET.Core/Tensors/Tensor.Operators.cs +++ b/src/TensorFlowNET.Core/Tensors/Tensor.Operators.cs @@ -16,7 +16,7 @@ using System; using System.Linq; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Tensors/Tensor.cs b/src/TensorFlowNET.Core/Tensors/Tensor.cs index 312dde43..d52b9422 100644 --- a/src/TensorFlowNET.Core/Tensors/Tensor.cs +++ b/src/TensorFlowNET.Core/Tensors/Tensor.cs @@ -21,7 +21,7 @@ using System.Linq; using System.Runtime.InteropServices; using System.Text; using Tensorflow.Framework; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Train/AdamOptimizer.cs b/src/TensorFlowNET.Core/Train/AdamOptimizer.cs index 673e1307..d182a5cd 100644 --- a/src/TensorFlowNET.Core/Train/AdamOptimizer.cs +++ b/src/TensorFlowNET.Core/Train/AdamOptimizer.cs @@ -18,7 +18,7 @@ using System; using System.Collections.Generic; using System.Linq; using Tensorflow.Framework; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow.Train { diff --git a/src/TensorFlowNET.Core/Train/Optimizer.cs b/src/TensorFlowNET.Core/Train/Optimizer.cs index 56041826..c031da54 100644 --- a/src/TensorFlowNET.Core/Train/Optimizer.cs +++ b/src/TensorFlowNET.Core/Train/Optimizer.cs @@ -19,7 +19,6 @@ using System.Collections.Generic; using System.Linq; using Tensorflow.Framework; using Tensorflow.Train; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace Tensorflow @@ -383,7 +382,7 @@ namespace Tensorflow if ((int)gate_gradients == Optimizer.GATE_GRAPH) grads = control_flow_ops.tuple(grads); - var grads_and_vars = Python.zip(grads, var_list) + var grads_and_vars = zip(grads, var_list) .Select(x => new Tuple(x.Item1, x.Item2)) .ToArray(); diff --git a/src/TensorFlowNET.Core/Train/Saving/BaseSaverBuilder.cs b/src/TensorFlowNET.Core/Train/Saving/BaseSaverBuilder.cs index 95775a72..c9b60d32 100644 --- a/src/TensorFlowNET.Core/Train/Saving/BaseSaverBuilder.cs +++ b/src/TensorFlowNET.Core/Train/Saving/BaseSaverBuilder.cs @@ -18,7 +18,7 @@ using System; using System.Collections.Generic; using System.Linq; using Tensorflow.Operations; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Train/Saving/Saver.cs b/src/TensorFlowNET.Core/Train/Saving/Saver.cs index aea585c5..3f72a438 100644 --- a/src/TensorFlowNET.Core/Train/Saving/Saver.cs +++ b/src/TensorFlowNET.Core/Train/Saving/Saver.cs @@ -18,7 +18,6 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace Tensorflow @@ -145,7 +144,7 @@ namespace Tensorflow _check_saver_def(); - _next_checkpoint_time = Python.time() + _saver_def.KeepCheckpointEveryNHours * 3600; + _next_checkpoint_time = time() + _saver_def.KeepCheckpointEveryNHours * 3600; } private void _check_saver_def() diff --git a/src/TensorFlowNET.Core/Train/Saving/saveable_object_util.py.cs b/src/TensorFlowNET.Core/Train/Saving/saveable_object_util.py.cs index 267e7561..1e119405 100644 --- a/src/TensorFlowNET.Core/Train/Saving/saveable_object_util.py.cs +++ b/src/TensorFlowNET.Core/Train/Saving/saveable_object_util.py.cs @@ -17,7 +17,7 @@ using System; using System.Collections.Generic; using System.Linq; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Train/SlotCreator.cs b/src/TensorFlowNET.Core/Train/SlotCreator.cs index 0872d8a6..29e073c7 100644 --- a/src/TensorFlowNET.Core/Train/SlotCreator.cs +++ b/src/TensorFlowNET.Core/Train/SlotCreator.cs @@ -16,7 +16,6 @@ using System; using Tensorflow.Operations.Initializers; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace Tensorflow.Train diff --git a/src/TensorFlowNET.Core/Util/nest.py.cs b/src/TensorFlowNET.Core/Util/nest.py.cs index 5f782ba2..b3ae594f 100644 --- a/src/TensorFlowNET.Core/Util/nest.py.cs +++ b/src/TensorFlowNET.Core/Util/nest.py.cs @@ -79,10 +79,10 @@ namespace Tensorflow.Util } public static IEnumerable<(T1, T2)> zip(IEnumerable e1, IEnumerable e2) - => Python.zip(e1, e2); + => zip(e1, e2); public static Dictionary ConvertToDict(object dyn) - => Python.ConvertToDict(dyn); + => ConvertToDict(dyn); //def _get_attrs_values(obj): // """Returns the list of values from an attrs instance.""" diff --git a/src/TensorFlowNET.Core/Variables/PureVariableScope.cs b/src/TensorFlowNET.Core/Variables/PureVariableScope.cs index b6cd2add..2326d9e3 100644 --- a/src/TensorFlowNET.Core/Variables/PureVariableScope.cs +++ b/src/TensorFlowNET.Core/Variables/PureVariableScope.cs @@ -19,7 +19,7 @@ using System.Linq; namespace Tensorflow { - public class PureVariableScope : IPython + public class PureVariableScope : IObjectLife { private string _name; private VariableScope _scope; @@ -101,6 +101,16 @@ namespace Tensorflow _var_scope_store.current_scope = _old; } + public void __init__() + { + + } + + public void __del__() + { + + } + public static implicit operator VariableScope(PureVariableScope scope) { return scope.variable_scope_object; diff --git a/src/TensorFlowNET.Core/Variables/RefVariable.Operators.cs b/src/TensorFlowNET.Core/Variables/RefVariable.Operators.cs index 5adf5d9a..b4c77226 100644 --- a/src/TensorFlowNET.Core/Variables/RefVariable.Operators.cs +++ b/src/TensorFlowNET.Core/Variables/RefVariable.Operators.cs @@ -14,7 +14,7 @@ limitations under the License. ******************************************************************************/ -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Variables/RefVariable.cs b/src/TensorFlowNET.Core/Variables/RefVariable.cs index 463ba2d0..9ac7e6ea 100644 --- a/src/TensorFlowNET.Core/Variables/RefVariable.cs +++ b/src/TensorFlowNET.Core/Variables/RefVariable.cs @@ -17,7 +17,7 @@ using Google.Protobuf; using System; using System.Collections.Generic; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Variables/VariableScope.cs b/src/TensorFlowNET.Core/Variables/VariableScope.cs index 778e59b1..afc221c8 100644 --- a/src/TensorFlowNET.Core/Variables/VariableScope.cs +++ b/src/TensorFlowNET.Core/Variables/VariableScope.cs @@ -14,7 +14,7 @@ limitations under the License. ******************************************************************************/ -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Variables/variable_scope.py.cs b/src/TensorFlowNET.Core/Variables/variable_scope.py.cs index 9a658c77..6bc83052 100644 --- a/src/TensorFlowNET.Core/Variables/variable_scope.py.cs +++ b/src/TensorFlowNET.Core/Variables/variable_scope.py.cs @@ -23,7 +23,7 @@ namespace Tensorflow /// /// A context manager for defining ops that creates variables (layers). /// - public class variable_scope : IPython + public class variable_scope : IObjectLife { public static string _VARSTORE_KEY = "__variable_store"; public static string _VARSCOPESTORE_KEY = "__varscope"; @@ -293,5 +293,15 @@ namespace Tensorflow { throw new NotImplementedException(); } + + public void __init__() + { + + } + + public void __del__() + { + + } } } diff --git a/src/TensorFlowNET.Core/ops._DefaultStack.cs b/src/TensorFlowNET.Core/ops._DefaultStack.cs index ecdd8d9b..3a6932a4 100644 --- a/src/TensorFlowNET.Core/ops._DefaultStack.cs +++ b/src/TensorFlowNET.Core/ops._DefaultStack.cs @@ -23,7 +23,7 @@ namespace Tensorflow { _DefaultStack _default_session_stack = new _DefaultStack(); - public class _DefaultStack : IPython + public class _DefaultStack : IObjectLife { Stack stack; bool _enforce_nesting = true; @@ -35,18 +35,28 @@ namespace Tensorflow public void __enter__() { - throw new NotImplementedException(); + } public void __exit__() { - throw new NotImplementedException(); + } public void Dispose() { throw new NotImplementedException(); } + + public void __init__() + { + + } + + public void __del__() + { + + } } } } diff --git a/src/TensorFlowNET.Core/ops.py.cs b/src/TensorFlowNET.Core/ops.cs similarity index 99% rename from src/TensorFlowNET.Core/ops.py.cs rename to src/TensorFlowNET.Core/ops.cs index 97cc6861..b2945f13 100644 --- a/src/TensorFlowNET.Core/ops.py.cs +++ b/src/TensorFlowNET.Core/ops.cs @@ -20,7 +20,6 @@ using System.Runtime.InteropServices; using Google.Protobuf; using System.Linq; using NumSharp; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace Tensorflow @@ -448,7 +447,7 @@ namespace Tensorflow { var ret = new List(); - foreach(var (i, value) in Python.enumerate(values)) + foreach(var (i, value) in enumerate(values)) { if (value == null) { diff --git a/src/TensorFlowNET.Core/ops.name_scope.cs b/src/TensorFlowNET.Core/ops.name_scope.cs index 7096c6ad..bd98f2ca 100644 --- a/src/TensorFlowNET.Core/ops.name_scope.cs +++ b/src/TensorFlowNET.Core/ops.name_scope.cs @@ -27,7 +27,7 @@ namespace Tensorflow /// /// Returns a context manager that creates hierarchical names for operations. /// - public class NameScope : IPython + public class NameScope : IObjectLife { public string _name; public string _default_name; @@ -70,6 +70,16 @@ namespace Tensorflow { } + public void __init__() + { + + } + + public void __del__() + { + + } + /// /// __enter__() /// diff --git a/src/TensorFlowNET.Core/tensorflow.cs b/src/TensorFlowNET.Core/tensorflow.cs index c3857e66..da873722 100644 --- a/src/TensorFlowNET.Core/tensorflow.cs +++ b/src/TensorFlowNET.Core/tensorflow.cs @@ -18,7 +18,7 @@ using Tensorflow.Eager; namespace Tensorflow { - public partial class tensorflow : IPyClass + public partial class tensorflow : IObjectLife { public TF_DataType @byte = TF_DataType.TF_UINT8; public TF_DataType @sbyte = TF_DataType.TF_INT8; @@ -78,22 +78,27 @@ namespace Tensorflow return new Session(null, opts); } - public void __init__(IPyClass self) + public void __init__() { } - public void __enter__(IPyClass self) + public void __enter__() { } - public void __exit__(IPyClass self) + public void __exit__() { } - public void __del__(IPyClass self) + public void __del__() + { + + } + + public void Dispose() { } diff --git a/test/TensorFlowNET.Examples.FSharp/FunctionApproximation.fs b/test/TensorFlowNET.Examples.FSharp/FunctionApproximation.fs index 4b9d3fbb..9b32dc63 100644 --- a/test/TensorFlowNET.Examples.FSharp/FunctionApproximation.fs +++ b/test/TensorFlowNET.Examples.FSharp/FunctionApproximation.fs @@ -39,7 +39,7 @@ let run()= let n_hidden_layer_1 = 25 // Hidden layer 1 let n_hidden_layer_2 = 25 // Hidden layer 2 - let tf = Python.New() + let tf = Binding.New() let x = tf.placeholder(tf.float64, new TensorShape(N_points,n_input)) let y = tf.placeholder(tf.float64, new TensorShape(n_output)) @@ -77,7 +77,7 @@ let run()= let init = tf.global_variables_initializer() - Tensorflow.Python.``tf_with``(tf.Session(), fun (sess:Session) -> + Tensorflow.Binding.``tf_with``(tf.Session(), fun (sess:Session) -> sess.run(init) |> ignore // Loop over epochs for epoch in [0..training_epochs] do diff --git a/test/TensorFlowNET.Examples/BasicModels/KMeansClustering.cs b/test/TensorFlowNET.Examples/BasicModels/KMeansClustering.cs index b1aea250..ecd9e27d 100644 --- a/test/TensorFlowNET.Examples/BasicModels/KMeansClustering.cs +++ b/test/TensorFlowNET.Examples/BasicModels/KMeansClustering.cs @@ -19,7 +19,6 @@ using System; using System.Diagnostics; using Tensorflow; using Tensorflow.Hub; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.Examples diff --git a/test/TensorFlowNET.Examples/BasicModels/LinearRegression.cs b/test/TensorFlowNET.Examples/BasicModels/LinearRegression.cs index 8d74ec27..a9dfbe7e 100644 --- a/test/TensorFlowNET.Examples/BasicModels/LinearRegression.cs +++ b/test/TensorFlowNET.Examples/BasicModels/LinearRegression.cs @@ -17,7 +17,6 @@ using NumSharp; using System; using Tensorflow; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.Examples diff --git a/test/TensorFlowNET.Examples/BasicModels/LogisticRegression.cs b/test/TensorFlowNET.Examples/BasicModels/LogisticRegression.cs index af7b6668..73d40d28 100644 --- a/test/TensorFlowNET.Examples/BasicModels/LogisticRegression.cs +++ b/test/TensorFlowNET.Examples/BasicModels/LogisticRegression.cs @@ -20,7 +20,6 @@ using System.Diagnostics; using System.IO; using Tensorflow; using Tensorflow.Hub; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.Examples diff --git a/test/TensorFlowNET.Examples/BasicModels/NearestNeighbor.cs b/test/TensorFlowNET.Examples/BasicModels/NearestNeighbor.cs index 3890f500..22607c3d 100644 --- a/test/TensorFlowNET.Examples/BasicModels/NearestNeighbor.cs +++ b/test/TensorFlowNET.Examples/BasicModels/NearestNeighbor.cs @@ -18,7 +18,6 @@ using NumSharp; using System; using Tensorflow; using Tensorflow.Hub; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.Examples diff --git a/test/TensorFlowNET.Examples/ImageProcessing/CIFAR10-CNN.cs b/test/TensorFlowNET.Examples/ImageProcessing/CIFAR10-CNN.cs index a77a5b00..477ce85e 100644 --- a/test/TensorFlowNET.Examples/ImageProcessing/CIFAR10-CNN.cs +++ b/test/TensorFlowNET.Examples/ImageProcessing/CIFAR10-CNN.cs @@ -19,7 +19,6 @@ using System.Collections.Generic; using System.Text; using Tensorflow; using TensorFlowDatasets; -using static Tensorflow.Python; namespace TensorFlowNET.Examples { diff --git a/test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionCNN.cs b/test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionCNN.cs index 42d2d4d1..ab387fa5 100644 --- a/test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionCNN.cs +++ b/test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionCNN.cs @@ -19,7 +19,6 @@ using System; using System.Diagnostics; using Tensorflow; using Tensorflow.Hub; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.Examples diff --git a/test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionNN.cs b/test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionNN.cs index 0c6e2cd8..a68b58ef 100644 --- a/test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionNN.cs +++ b/test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionNN.cs @@ -18,7 +18,6 @@ using NumSharp; using System; using Tensorflow; using Tensorflow.Hub; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.Examples diff --git a/test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionRNN.cs b/test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionRNN.cs index a5606de1..76d3d63f 100644 --- a/test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionRNN.cs +++ b/test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionRNN.cs @@ -18,7 +18,6 @@ using NumSharp; using System; using Tensorflow; using Tensorflow.Hub; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.Examples diff --git a/test/TensorFlowNET.Examples/ImageProcessing/RetrainImageClassifier.cs b/test/TensorFlowNET.Examples/ImageProcessing/RetrainImageClassifier.cs index 7e0bbdc6..79cc548f 100644 --- a/test/TensorFlowNET.Examples/ImageProcessing/RetrainImageClassifier.cs +++ b/test/TensorFlowNET.Examples/ImageProcessing/RetrainImageClassifier.cs @@ -23,7 +23,6 @@ using System.IO; using System.Linq; using Tensorflow; using TensorFlowNET.Examples.Utility; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.Examples diff --git a/test/TensorFlowNET.Examples/TextProcessing/CnnTextClassification.cs b/test/TensorFlowNET.Examples/TextProcessing/CnnTextClassification.cs index 55e2516a..3519d972 100644 --- a/test/TensorFlowNET.Examples/TextProcessing/CnnTextClassification.cs +++ b/test/TensorFlowNET.Examples/TextProcessing/CnnTextClassification.cs @@ -24,7 +24,6 @@ using Tensorflow; using Tensorflow.Sessions; using TensorFlowNET.Examples.Text; using TensorFlowNET.Examples.Utility; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.Examples diff --git a/test/TensorFlowNET.Examples/TextProcessing/NER/LstmCrfNer.cs b/test/TensorFlowNET.Examples/TextProcessing/NER/LstmCrfNer.cs index 2e18a680..42eab6c4 100644 --- a/test/TensorFlowNET.Examples/TextProcessing/NER/LstmCrfNer.cs +++ b/test/TensorFlowNET.Examples/TextProcessing/NER/LstmCrfNer.cs @@ -6,7 +6,6 @@ using System.Linq; using Tensorflow; using Tensorflow.Estimator; using TensorFlowNET.Examples.Utility; -using static Tensorflow.Python; using static Tensorflow.Binding; using static TensorFlowNET.Examples.DataHelpers; diff --git a/test/TensorFlowNET.Examples/TextProcessing/Word2Vec.cs b/test/TensorFlowNET.Examples/TextProcessing/Word2Vec.cs index b4da37a9..ba945606 100644 --- a/test/TensorFlowNET.Examples/TextProcessing/Word2Vec.cs +++ b/test/TensorFlowNET.Examples/TextProcessing/Word2Vec.cs @@ -5,7 +5,6 @@ using System.IO; using System.Linq; using Tensorflow; using TensorFlowNET.Examples.Utility; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.Examples diff --git a/test/TensorFlowNET.Examples/TextProcessing/cnn_models/CharCnn.cs b/test/TensorFlowNET.Examples/TextProcessing/cnn_models/CharCnn.cs index 1cbddf84..63132809 100644 --- a/test/TensorFlowNET.Examples/TextProcessing/cnn_models/CharCnn.cs +++ b/test/TensorFlowNET.Examples/TextProcessing/cnn_models/CharCnn.cs @@ -1,5 +1,4 @@ using Tensorflow; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.Examples.Text diff --git a/test/TensorFlowNET.Examples/TextProcessing/cnn_models/VdCnn.cs b/test/TensorFlowNET.Examples/TextProcessing/cnn_models/VdCnn.cs index 0f6c74fd..9b28fdc0 100644 --- a/test/TensorFlowNET.Examples/TextProcessing/cnn_models/VdCnn.cs +++ b/test/TensorFlowNET.Examples/TextProcessing/cnn_models/VdCnn.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Linq; using Tensorflow; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.Examples.Text diff --git a/test/TensorFlowNET.Examples/TextProcessing/cnn_models/WordCnn.cs b/test/TensorFlowNET.Examples/TextProcessing/cnn_models/WordCnn.cs index 057322d4..ef5bc9db 100644 --- a/test/TensorFlowNET.Examples/TextProcessing/cnn_models/WordCnn.cs +++ b/test/TensorFlowNET.Examples/TextProcessing/cnn_models/WordCnn.cs @@ -16,7 +16,6 @@ using System.Collections.Generic; using Tensorflow; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.Examples.Text diff --git a/test/TensorFlowNET.UnitTest/Basics/AssignTests.cs b/test/TensorFlowNET.UnitTest/Basics/AssignTests.cs index 3cb85de7..15d9b819 100644 --- a/test/TensorFlowNET.UnitTest/Basics/AssignTests.cs +++ b/test/TensorFlowNET.UnitTest/Basics/AssignTests.cs @@ -1,5 +1,4 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.UnitTest.Basics diff --git a/test/TensorFlowNET.UnitTest/GradientTest.cs b/test/TensorFlowNET.UnitTest/GradientTest.cs index 63bea584..b52bc1cf 100644 --- a/test/TensorFlowNET.UnitTest/GradientTest.cs +++ b/test/TensorFlowNET.UnitTest/GradientTest.cs @@ -2,7 +2,6 @@ using NumSharp; using System.Linq; using Tensorflow; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.UnitTest diff --git a/test/TensorFlowNET.UnitTest/NameScopeTest.cs b/test/TensorFlowNET.UnitTest/NameScopeTest.cs index b6f1ecf6..4ff50deb 100644 --- a/test/TensorFlowNET.UnitTest/NameScopeTest.cs +++ b/test/TensorFlowNET.UnitTest/NameScopeTest.cs @@ -1,6 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Tensorflow; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.UnitTest diff --git a/test/TensorFlowNET.UnitTest/PythonBaseTests.cs b/test/TensorFlowNET.UnitTest/PythonBaseTests.cs index 436f5154..6fd0d7c3 100644 --- a/test/TensorFlowNET.UnitTest/PythonBaseTests.cs +++ b/test/TensorFlowNET.UnitTest/PythonBaseTests.cs @@ -1,6 +1,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Tensorflow; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace TensorFlowNET.UnitTest { diff --git a/test/TensorFlowNET.UnitTest/PythonTest.cs b/test/TensorFlowNET.UnitTest/PythonTest.cs index bb6ac673..701b4b4b 100644 --- a/test/TensorFlowNET.UnitTest/PythonTest.cs +++ b/test/TensorFlowNET.UnitTest/PythonTest.cs @@ -238,7 +238,7 @@ namespace TensorFlowNET.UnitTest return s.as_default(); } - private IPython _constrain_devices_and_set_default(Session sess, bool useGpu, bool forceGpu) + private IObjectLife _constrain_devices_and_set_default(Session sess, bool useGpu, bool forceGpu) { //def _constrain_devices_and_set_default(self, sess, use_gpu, force_gpu): //"""Set the session and its graph to global default and constrain devices.""" diff --git a/test/TensorFlowNET.UnitTest/TensorTest.cs b/test/TensorFlowNET.UnitTest/TensorTest.cs index 2fc8fa02..07da9dca 100644 --- a/test/TensorFlowNET.UnitTest/TensorTest.cs +++ b/test/TensorFlowNET.UnitTest/TensorTest.cs @@ -5,7 +5,6 @@ using System.Linq; using System.Runtime.InteropServices; using System.Threading; using Tensorflow; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.UnitTest diff --git a/test/TensorFlowNET.UnitTest/TrainSaverTest.cs b/test/TensorFlowNET.UnitTest/TrainSaverTest.cs index 0aaa18c4..ce68e2b5 100644 --- a/test/TensorFlowNET.UnitTest/TrainSaverTest.cs +++ b/test/TensorFlowNET.UnitTest/TrainSaverTest.cs @@ -1,7 +1,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using Tensorflow; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.UnitTest diff --git a/test/TensorFlowNET.UnitTest/VariableTest.cs b/test/TensorFlowNET.UnitTest/VariableTest.cs index 15cc053a..4c5ddd7a 100644 --- a/test/TensorFlowNET.UnitTest/VariableTest.cs +++ b/test/TensorFlowNET.UnitTest/VariableTest.cs @@ -1,6 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Tensorflow; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.UnitTest diff --git a/test/TensorFlowNET.UnitTest/control_flow_ops_test/WhileContextTestCase.cs b/test/TensorFlowNET.UnitTest/control_flow_ops_test/WhileContextTestCase.cs index 2bbc47c5..4e82a2b6 100644 --- a/test/TensorFlowNET.UnitTest/control_flow_ops_test/WhileContextTestCase.cs +++ b/test/TensorFlowNET.UnitTest/control_flow_ops_test/WhileContextTestCase.cs @@ -1,7 +1,6 @@ using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using Tensorflow; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.UnitTest.control_flow_ops_test diff --git a/test/TensorFlowNET.UnitTest/nest_test/NestTest.cs b/test/TensorFlowNET.UnitTest/nest_test/NestTest.cs index 8f924015..53334349 100644 --- a/test/TensorFlowNET.UnitTest/nest_test/NestTest.cs +++ b/test/TensorFlowNET.UnitTest/nest_test/NestTest.cs @@ -6,7 +6,6 @@ using Newtonsoft.Json.Linq; using NumSharp; using Tensorflow; using Tensorflow.Util; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.UnitTest.nest_test diff --git a/test/TensorFlowNET.UnitTest/nn_test/ZeroFractionTest.cs b/test/TensorFlowNET.UnitTest/nn_test/ZeroFractionTest.cs index 3f52d887..1fd7d3aa 100644 --- a/test/TensorFlowNET.UnitTest/nn_test/ZeroFractionTest.cs +++ b/test/TensorFlowNET.UnitTest/nn_test/ZeroFractionTest.cs @@ -3,7 +3,7 @@ using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using NumSharp; using Tensorflow; -using static Tensorflow.Python; +using static Tensorflow.Binding; namespace TensorFlowNET.UnitTest.nn_test { diff --git a/test/TensorFlowNET.UnitTest/ops_test/ControlDependenciesTest.cs b/test/TensorFlowNET.UnitTest/ops_test/ControlDependenciesTest.cs index 67effad4..f39a71b2 100644 --- a/test/TensorFlowNET.UnitTest/ops_test/ControlDependenciesTest.cs +++ b/test/TensorFlowNET.UnitTest/ops_test/ControlDependenciesTest.cs @@ -3,7 +3,6 @@ using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using Tensorflow; using Tensorflow.Eager; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.UnitTest.ops_test diff --git a/test/TensorFlowNET.UnitTest/ops_test/CreateOpFromTfOperationTest.cs b/test/TensorFlowNET.UnitTest/ops_test/CreateOpFromTfOperationTest.cs index a5cbf88f..cdbd5f14 100644 --- a/test/TensorFlowNET.UnitTest/ops_test/CreateOpFromTfOperationTest.cs +++ b/test/TensorFlowNET.UnitTest/ops_test/CreateOpFromTfOperationTest.cs @@ -3,7 +3,6 @@ using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using Tensorflow; using Tensorflow.Operations; -using static Tensorflow.Python; using static Tensorflow.Binding; namespace TensorFlowNET.UnitTest.ops_test