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