| @@ -16,7 +16,7 @@ | |||||
| using Tensorflow.Operations; | using Tensorflow.Operations; | ||||
| using Tensorflow.Operations.Activation; | using Tensorflow.Operations.Activation; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -141,7 +141,7 @@ namespace Tensorflow | |||||
| public Tensor bias_add(Tensor value, RefVariable bias, string data_format = null, string name = null) | 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; | name = scope; | ||||
| return gen_nn_ops.bias_add(value, bias, data_format: data_format, name: name); | return gen_nn_ops.bias_add(value, bias, data_format: data_format, name: name); | ||||
| @@ -15,7 +15,6 @@ | |||||
| ******************************************************************************/ | ******************************************************************************/ | ||||
| using NumSharp; | using NumSharp; | ||||
| using NumSharp.Backends; | |||||
| using System; | using System; | ||||
| using System.Collections; | using System.Collections; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| @@ -26,18 +25,15 @@ using System.Linq; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| /// Mapping C# functions to Python | |||||
| /// Binding utilities to mimic python functions. | |||||
| /// </summary> | /// </summary> | ||||
| public static class Python | |||||
| public static partial class Binding | |||||
| { | { | ||||
| public static void print(object obj) | public static void print(object obj) | ||||
| { | { | ||||
| Console.WriteLine(obj.ToString()); | Console.WriteLine(obj.ToString()); | ||||
| } | } | ||||
| //protected int len<T>(IEnumerable<T> a) | |||||
| // => a.Count(); | |||||
| public static int len(object a) | public static int len(object a) | ||||
| { | { | ||||
| switch (a) | switch (a) | ||||
| @@ -66,15 +62,15 @@ namespace Tensorflow | |||||
| return Enumerable.Range(start, end - start); | return Enumerable.Range(start, end - start); | ||||
| } | } | ||||
| public static T New<T>() where T : IPyClass, new() | |||||
| public static T New<T>() where T : IObjectLife, new() | |||||
| { | { | ||||
| var instance = new T(); | var instance = new T(); | ||||
| instance.__init__(instance); | |||||
| instance.__init__(); | |||||
| return instance; | return instance; | ||||
| } | } | ||||
| [DebuggerNonUserCode()] // with "Just My Code" enabled this lets the debugger break at the origin of the exception | [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<IPython> action) | |||||
| public static void tf_with(IObjectLife py, Action<IObjectLife> action) | |||||
| { | { | ||||
| try | try | ||||
| { | { | ||||
| @@ -94,7 +90,7 @@ namespace Tensorflow | |||||
| } | } | ||||
| [DebuggerNonUserCode()] // with "Just My Code" enabled this lets the debugger break at the origin of the exception | [DebuggerNonUserCode()] // with "Just My Code" enabled this lets the debugger break at the origin of the exception | ||||
| public static void tf_with<T>(T py, Action<T> action) where T : IPython | |||||
| public static void tf_with<T>(T py, Action<T> action) where T : IObjectLife | |||||
| { | { | ||||
| try | try | ||||
| { | { | ||||
| @@ -114,7 +110,7 @@ namespace Tensorflow | |||||
| } | } | ||||
| [DebuggerNonUserCode()] // with "Just My Code" enabled this lets the debugger break at the origin of the exception | [DebuggerNonUserCode()] // with "Just My Code" enabled this lets the debugger break at the origin of the exception | ||||
| public static TOut tf_with<TIn, TOut>(TIn py, Func<TIn, TOut> action) where TIn : IPython | |||||
| public static TOut tf_with<TIn, TOut>(TIn py, Func<TIn, TOut> action) where TIn : IObjectLife | |||||
| { | { | ||||
| try | try | ||||
| { | { | ||||
| @@ -124,7 +120,6 @@ namespace Tensorflow | |||||
| catch (Exception ex) | catch (Exception ex) | ||||
| { | { | ||||
| Console.WriteLine(ex.ToString()); | Console.WriteLine(ex.ToString()); | ||||
| throw; | |||||
| return default(TOut); | return default(TOut); | ||||
| } | } | ||||
| finally | finally | ||||
| @@ -276,7 +271,9 @@ namespace Tensorflow | |||||
| var __memberobject__ = __type__.GetMember(key); | var __memberobject__ = __type__.GetMember(key); | ||||
| return (__memberobject__.Length > 0) ? true : false; | return (__memberobject__.Length > 0) ? true : false; | ||||
| } | } | ||||
| public delegate object __object__(params object[] args); | public delegate object __object__(params object[] args); | ||||
| public static __object__ getattr(object obj, string key, params Type[] ___parameter_type__) | public static __object__ getattr(object obj, string key, params Type[] ___parameter_type__) | ||||
| { | { | ||||
| var __dyn_obj__ = obj.GetType().GetMember(key); | var __dyn_obj__ = obj.GetType().GetMember(key); | ||||
| @@ -288,7 +285,7 @@ namespace Tensorflow | |||||
| try | try | ||||
| { | { | ||||
| var __method__ = (___parameter_type__.Length > 0) ? obj.GetType().GetMethod(key, ___parameter_type__) : obj.GetType().GetMethod(key); | 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) | catch (System.Reflection.AmbiguousMatchException ex) | ||||
| { | { | ||||
| @@ -297,16 +294,17 @@ namespace Tensorflow | |||||
| } | } | ||||
| else if (__type__.MemberType == System.Reflection.MemberTypes.Field) | 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) | 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) | public static IEnumerable TupleToEnumerable(object tuple) | ||||
| { | { | ||||
| Type t = tuple.GetType(); | Type t = tuple.GetType(); | ||||
| @@ -315,7 +313,7 @@ namespace Tensorflow | |||||
| var flds = t.GetFields(); | var flds = t.GetFields(); | ||||
| for(int i = 0; i < flds.Length;i++) | for(int i = 0; i < flds.Length;i++) | ||||
| { | { | ||||
| yield return ((object)flds[i].GetValue(tuple)); | |||||
| yield return flds[i].GetValue(tuple); | |||||
| } | } | ||||
| } | } | ||||
| else | else | ||||
| @@ -323,10 +321,12 @@ namespace Tensorflow | |||||
| throw new System.Exception("Expected Tuple."); | throw new System.Exception("Expected Tuple."); | ||||
| } | } | ||||
| } | } | ||||
| public static bool isinstance(object Item1, Type Item2) | public static bool isinstance(object Item1, Type Item2) | ||||
| { | { | ||||
| return (Item1.GetType() == Item2); | |||||
| return Item1.GetType() == Item2; | |||||
| } | } | ||||
| public static bool isinstance(object Item1, object tuple) | public static bool isinstance(object Item1, object tuple) | ||||
| { | { | ||||
| var tup = TupleToEnumerable(tuple); | var tup = TupleToEnumerable(tuple); | ||||
| @@ -338,11 +338,4 @@ namespace Tensorflow | |||||
| return false; | return false; | ||||
| } | } | ||||
| } | } | ||||
| public interface IPython : IDisposable | |||||
| { | |||||
| void __enter__(); | |||||
| void __exit__(); | |||||
| } | |||||
| } | } | ||||
| @@ -4,8 +4,8 @@ using System.Text; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| public static class Binding | |||||
| public static partial class Binding | |||||
| { | { | ||||
| public static tensorflow tf { get; } = Python.New<tensorflow>(); | |||||
| public static tensorflow tf { get; } = New<tensorflow>(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -15,7 +15,7 @@ | |||||
| ******************************************************************************/ | ******************************************************************************/ | ||||
| using System.Linq; | using System.Linq; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow.Clustering | namespace Tensorflow.Clustering | ||||
| { | { | ||||
| @@ -18,7 +18,7 @@ using NumSharp; | |||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Linq; | using System.Linq; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -19,7 +19,7 @@ using System; | |||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Linq; | using System.Linq; | ||||
| using static Tensorflow.OpDef.Types; | using static Tensorflow.OpDef.Types; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -17,7 +17,6 @@ | |||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Linq; | using System.Linq; | ||||
| using Tensorflow.Framework; | using Tensorflow.Framework; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace Tensorflow.Gradients | namespace Tensorflow.Gradients | ||||
| @@ -17,7 +17,7 @@ | |||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Linq; | using System.Linq; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -17,7 +17,6 @@ | |||||
| using System; | using System; | ||||
| using System.Linq; | using System.Linq; | ||||
| using Tensorflow.Operations; | using Tensorflow.Operations; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace Tensorflow.Gradients | namespace Tensorflow.Gradients | ||||
| @@ -19,6 +19,7 @@ using System.Collections; | |||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Linq; | using System.Linq; | ||||
| using System.Runtime.InteropServices; | using System.Runtime.InteropServices; | ||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -247,7 +248,7 @@ namespace Tensorflow | |||||
| if (inputs == null) | if (inputs == null) | ||||
| inputs = new Tensor[0]; | inputs = new Tensor[0]; | ||||
| foreach ((int idx, Tensor a) in Python.enumerate(inputs)) | |||||
| foreach ((int idx, Tensor a) in enumerate(inputs)) | |||||
| { | { | ||||
| } | } | ||||
| @@ -22,7 +22,7 @@ namespace Tensorflow | |||||
| /// <summary> | /// <summary> | ||||
| /// Context manager for `control_dependencies()` | /// Context manager for `control_dependencies()` | ||||
| /// </summary> | /// </summary> | ||||
| public class _ControlDependenciesController : IPython | |||||
| public class _ControlDependenciesController : IObjectLife | |||||
| { | { | ||||
| private Graph _graph; | private Graph _graph; | ||||
| private List<ITensorOrOperation> _control_inputs_val; | private List<ITensorOrOperation> _control_inputs_val; | ||||
| @@ -110,6 +110,16 @@ namespace Tensorflow | |||||
| public void Dispose() | public void Dispose() | ||||
| { | { | ||||
| } | |||||
| } | |||||
| public void __init__() | |||||
| { | |||||
| } | |||||
| public void __del__() | |||||
| { | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -14,20 +14,22 @@ | |||||
| limitations under the License. | limitations under the License. | ||||
| ******************************************************************************/ | ******************************************************************************/ | ||||
| using System; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| public interface IPyClass | |||||
| public interface IObjectLife : IDisposable | |||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| /// Called when the instance is created. | /// Called when the instance is created. | ||||
| /// </summary> | /// </summary> | ||||
| /// <param name="args"></param> | /// <param name="args"></param> | ||||
| void __init__(IPyClass self); | |||||
| void __init__(); | |||||
| void __enter__(IPyClass self); | |||||
| void __enter__(); | |||||
| void __exit__(IPyClass self); | |||||
| void __exit__(); | |||||
| void __del__(IPyClass self); | |||||
| void __del__(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -15,7 +15,7 @@ | |||||
| ******************************************************************************/ | ******************************************************************************/ | ||||
| using System; | using System; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow.Keras | namespace Tensorflow.Keras | ||||
| { | { | ||||
| @@ -18,7 +18,7 @@ using Tensorflow.Keras.Layers; | |||||
| namespace Tensorflow.Keras.Engine | namespace Tensorflow.Keras.Engine | ||||
| { | { | ||||
| public class Sequential : Model, IPython | |||||
| public class Sequential : Model, IObjectLife | |||||
| { | { | ||||
| public Sequential(string name = null) | public Sequential(string name = null) | ||||
| : base(name: name) | : base(name: name) | ||||
| @@ -69,5 +69,15 @@ namespace Tensorflow.Keras.Engine | |||||
| { | { | ||||
| } | } | ||||
| public void __init__() | |||||
| { | |||||
| } | |||||
| public void __del__() | |||||
| { | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -83,7 +83,7 @@ namespace Tensorflow.Keras.Layers | |||||
| protected override void build(TensorShape input_shape) | protected override void build(TensorShape input_shape) | ||||
| { | { | ||||
| var ndims = input_shape.ndim; | var ndims = input_shape.ndim; | ||||
| foreach (var (idx, x) in Python.enumerate(axis)) | |||||
| foreach (var (idx, x) in enumerate(axis)) | |||||
| if (x < 0) | if (x < 0) | ||||
| axis[idx] = ndims + x; | axis[idx] = ndims + x; | ||||
| @@ -208,7 +208,7 @@ namespace Tensorflow.Keras.Layers | |||||
| public Tensor _assign_moving_average(RefVariable variable, Tensor value, Tensor momentum) | 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 cm = ops.colocate_with(variable); | ||||
| var decay = ops.convert_to_tensor(1.0f - momentum, name: "decay"); | var decay = ops.convert_to_tensor(1.0f - momentum, name: "decay"); | ||||
| @@ -20,7 +20,6 @@ using System.Linq; | |||||
| using Tensorflow.Keras.Engine; | using Tensorflow.Keras.Engine; | ||||
| using Tensorflow.Keras.Utils; | using Tensorflow.Keras.Utils; | ||||
| using Tensorflow.Train; | using Tensorflow.Train; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace Tensorflow.Keras.Layers | namespace Tensorflow.Keras.Layers | ||||
| @@ -16,7 +16,6 @@ | |||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace Tensorflow.Keras | namespace Tensorflow.Keras | ||||
| @@ -16,7 +16,6 @@ | |||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace Tensorflow.Layers | namespace Tensorflow.Layers | ||||
| @@ -18,7 +18,7 @@ using System; | |||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Linq; | using System.Linq; | ||||
| using Tensorflow.Operations.ControlFlows; | using Tensorflow.Operations.ControlFlows; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow.Operations | namespace Tensorflow.Operations | ||||
| { | { | ||||
| @@ -39,7 +39,7 @@ namespace Tensorflow.Operations | |||||
| /// 4. A ControlFlowContext has _context_stack. | /// 4. A ControlFlowContext has _context_stack. | ||||
| /// Pushed and popped by ctxt.Enter() and ctxt.Exit() | /// Pushed and popped by ctxt.Enter() and ctxt.Exit() | ||||
| /// </summary> | /// </summary> | ||||
| public abstract class ControlFlowContext : IPython | |||||
| public abstract class ControlFlowContext : IObjectLife | |||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| /// The predicate tensor in this branch | /// The predicate tensor in this branch | ||||
| @@ -265,5 +265,14 @@ namespace Tensorflow.Operations | |||||
| { | { | ||||
| } | } | ||||
| public void __init__() | |||||
| { | |||||
| } | |||||
| public void __del__() | |||||
| { | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -19,8 +19,8 @@ using System.Collections.Generic; | |||||
| using System.Linq; | using System.Linq; | ||||
| using Tensorflow.Operations.ControlFlows; | using Tensorflow.Operations.ControlFlows; | ||||
| using Tensorflow.Util; | using Tensorflow.Util; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.control_flow_ops; | using static Tensorflow.control_flow_ops; | ||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow.Operations | namespace Tensorflow.Operations | ||||
| { | { | ||||
| @@ -17,7 +17,7 @@ | |||||
| //Base classes for probability distributions. | //Base classes for probability distributions. | ||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| @@ -16,7 +16,6 @@ | |||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace Tensorflow | namespace Tensorflow | ||||
| @@ -15,7 +15,7 @@ | |||||
| ******************************************************************************/ | ******************************************************************************/ | ||||
| using System; | using System; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -14,7 +14,7 @@ | |||||
| limitations under the License. | limitations under the License. | ||||
| ******************************************************************************/ | ******************************************************************************/ | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow.Operations | namespace Tensorflow.Operations | ||||
| { | { | ||||
| @@ -17,7 +17,6 @@ | |||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Linq; | using System.Linq; | ||||
| using static Tensorflow.Python; | |||||
| using Tensorflow.Util; | using Tensorflow.Util; | ||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| @@ -18,7 +18,7 @@ using System; | |||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Linq; | using System.Linq; | ||||
| using static Tensorflow.OpDef.Types; | using static Tensorflow.OpDef.Types; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -17,7 +17,7 @@ | |||||
| using System; | using System; | ||||
| using Tensorflow.Operations; | using Tensorflow.Operations; | ||||
| using Tensorflow.Util; | using Tensorflow.Util; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -17,7 +17,7 @@ | |||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Text; | using System.Text; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow.Operations | namespace Tensorflow.Operations | ||||
| { | { | ||||
| @@ -17,7 +17,6 @@ | |||||
| using NumSharp; | using NumSharp; | ||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace Tensorflow | namespace Tensorflow | ||||
| @@ -14,7 +14,7 @@ | |||||
| limitations under the License. | limitations under the License. | ||||
| ******************************************************************************/ | ******************************************************************************/ | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -15,7 +15,7 @@ | |||||
| ******************************************************************************/ | ******************************************************************************/ | ||||
| using System; | using System; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -20,7 +20,7 @@ using System.Linq; | |||||
| using Tensorflow.Operations; | using Tensorflow.Operations; | ||||
| using Tensorflow.Operations.ControlFlows; | using Tensorflow.Operations.ControlFlows; | ||||
| using util = Tensorflow.control_flow_util; | using util = Tensorflow.control_flow_util; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -15,7 +15,7 @@ | |||||
| ******************************************************************************/ | ******************************************************************************/ | ||||
| using System; | using System; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -15,7 +15,6 @@ | |||||
| ******************************************************************************/ | ******************************************************************************/ | ||||
| using System; | using System; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace Tensorflow | namespace Tensorflow | ||||
| @@ -18,7 +18,7 @@ using NumSharp; | |||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using Tensorflow.Framework; | using Tensorflow.Framework; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -15,7 +15,7 @@ | |||||
| ******************************************************************************/ | ******************************************************************************/ | ||||
| using Tensorflow.Operations; | using Tensorflow.Operations; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -17,7 +17,7 @@ | |||||
| using System; | using System; | ||||
| using System.Linq; | using System.Linq; | ||||
| using Tensorflow.Operations; | using Tensorflow.Operations; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -50,7 +50,7 @@ namespace Tensorflow | |||||
| string data_format = null, | string data_format = null, | ||||
| string name = 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; | name = scope; | ||||
| value = ops.convert_to_tensor(value, name: "input"); | value = ops.convert_to_tensor(value, name: "input"); | ||||
| @@ -14,7 +14,7 @@ | |||||
| limitations under the License. | limitations under the License. | ||||
| ******************************************************************************/ | ******************************************************************************/ | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -14,7 +14,7 @@ | |||||
| limitations under the License. | limitations under the License. | ||||
| ******************************************************************************/ | ******************************************************************************/ | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -19,7 +19,7 @@ using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| public class Session : BaseSession, IPython | |||||
| public class Session : BaseSession, IObjectLife | |||||
| { | { | ||||
| public Session(string target = "", Graph g = null) | public Session(string target = "", Graph g = null) | ||||
| : base(target, g, null) | : base(target, g, null) | ||||
| @@ -85,5 +85,15 @@ namespace Tensorflow | |||||
| { | { | ||||
| } | } | ||||
| public void __init__() | |||||
| { | |||||
| } | |||||
| public void __del__() | |||||
| { | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -16,7 +16,7 @@ | |||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Linq; | using System.Linq; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow.Summaries | namespace Tensorflow.Summaries | ||||
| { | { | ||||
| @@ -16,7 +16,7 @@ | |||||
| using System; | using System; | ||||
| using System.Linq; | using System.Linq; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -21,7 +21,7 @@ using System.Linq; | |||||
| using System.Runtime.InteropServices; | using System.Runtime.InteropServices; | ||||
| using System.Text; | using System.Text; | ||||
| using Tensorflow.Framework; | using Tensorflow.Framework; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -18,7 +18,7 @@ using System; | |||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Linq; | using System.Linq; | ||||
| using Tensorflow.Framework; | using Tensorflow.Framework; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow.Train | namespace Tensorflow.Train | ||||
| { | { | ||||
| @@ -19,7 +19,6 @@ using System.Collections.Generic; | |||||
| using System.Linq; | using System.Linq; | ||||
| using Tensorflow.Framework; | using Tensorflow.Framework; | ||||
| using Tensorflow.Train; | using Tensorflow.Train; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace Tensorflow | namespace Tensorflow | ||||
| @@ -383,7 +382,7 @@ namespace Tensorflow | |||||
| if ((int)gate_gradients == Optimizer.GATE_GRAPH) | if ((int)gate_gradients == Optimizer.GATE_GRAPH) | ||||
| grads = control_flow_ops.tuple(grads); | 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<Tensor, RefVariable>(x.Item1, x.Item2)) | .Select(x => new Tuple<Tensor, RefVariable>(x.Item1, x.Item2)) | ||||
| .ToArray(); | .ToArray(); | ||||
| @@ -18,7 +18,7 @@ using System; | |||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Linq; | using System.Linq; | ||||
| using Tensorflow.Operations; | using Tensorflow.Operations; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -18,7 +18,6 @@ using System; | |||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.IO; | using System.IO; | ||||
| using System.Linq; | using System.Linq; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace Tensorflow | namespace Tensorflow | ||||
| @@ -145,7 +144,7 @@ namespace Tensorflow | |||||
| _check_saver_def(); | _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() | private void _check_saver_def() | ||||
| @@ -17,7 +17,7 @@ | |||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Linq; | using System.Linq; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -16,7 +16,6 @@ | |||||
| using System; | using System; | ||||
| using Tensorflow.Operations.Initializers; | using Tensorflow.Operations.Initializers; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace Tensorflow.Train | namespace Tensorflow.Train | ||||
| @@ -79,10 +79,10 @@ namespace Tensorflow.Util | |||||
| } | } | ||||
| public static IEnumerable<(T1, T2)> zip<T1, T2>(IEnumerable<T1> e1, IEnumerable<T2> e2) | public static IEnumerable<(T1, T2)> zip<T1, T2>(IEnumerable<T1> e1, IEnumerable<T2> e2) | ||||
| => Python.zip(e1, e2); | |||||
| => zip(e1, e2); | |||||
| public static Dictionary<string, object> ConvertToDict(object dyn) | public static Dictionary<string, object> ConvertToDict(object dyn) | ||||
| => Python.ConvertToDict(dyn); | |||||
| => ConvertToDict(dyn); | |||||
| //def _get_attrs_values(obj): | //def _get_attrs_values(obj): | ||||
| // """Returns the list of values from an attrs instance.""" | // """Returns the list of values from an attrs instance.""" | ||||
| @@ -19,7 +19,7 @@ using System.Linq; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| public class PureVariableScope : IPython | |||||
| public class PureVariableScope : IObjectLife | |||||
| { | { | ||||
| private string _name; | private string _name; | ||||
| private VariableScope _scope; | private VariableScope _scope; | ||||
| @@ -101,6 +101,16 @@ namespace Tensorflow | |||||
| _var_scope_store.current_scope = _old; | _var_scope_store.current_scope = _old; | ||||
| } | } | ||||
| public void __init__() | |||||
| { | |||||
| } | |||||
| public void __del__() | |||||
| { | |||||
| } | |||||
| public static implicit operator VariableScope(PureVariableScope scope) | public static implicit operator VariableScope(PureVariableScope scope) | ||||
| { | { | ||||
| return scope.variable_scope_object; | return scope.variable_scope_object; | ||||
| @@ -14,7 +14,7 @@ | |||||
| limitations under the License. | limitations under the License. | ||||
| ******************************************************************************/ | ******************************************************************************/ | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -17,7 +17,7 @@ | |||||
| using Google.Protobuf; | using Google.Protobuf; | ||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -14,7 +14,7 @@ | |||||
| limitations under the License. | limitations under the License. | ||||
| ******************************************************************************/ | ******************************************************************************/ | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| @@ -23,7 +23,7 @@ namespace Tensorflow | |||||
| /// <summary> | /// <summary> | ||||
| /// A context manager for defining ops that creates variables (layers). | /// A context manager for defining ops that creates variables (layers). | ||||
| /// </summary> | /// </summary> | ||||
| public class variable_scope : IPython | |||||
| public class variable_scope : IObjectLife | |||||
| { | { | ||||
| public static string _VARSTORE_KEY = "__variable_store"; | public static string _VARSTORE_KEY = "__variable_store"; | ||||
| public static string _VARSCOPESTORE_KEY = "__varscope"; | public static string _VARSCOPESTORE_KEY = "__varscope"; | ||||
| @@ -293,5 +293,15 @@ namespace Tensorflow | |||||
| { | { | ||||
| throw new NotImplementedException(); | throw new NotImplementedException(); | ||||
| } | } | ||||
| public void __init__() | |||||
| { | |||||
| } | |||||
| public void __del__() | |||||
| { | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -23,7 +23,7 @@ namespace Tensorflow | |||||
| { | { | ||||
| _DefaultStack _default_session_stack = new _DefaultStack(); | _DefaultStack _default_session_stack = new _DefaultStack(); | ||||
| public class _DefaultStack : IPython | |||||
| public class _DefaultStack : IObjectLife | |||||
| { | { | ||||
| Stack<object> stack; | Stack<object> stack; | ||||
| bool _enforce_nesting = true; | bool _enforce_nesting = true; | ||||
| @@ -35,18 +35,28 @@ namespace Tensorflow | |||||
| public void __enter__() | public void __enter__() | ||||
| { | { | ||||
| throw new NotImplementedException(); | |||||
| } | } | ||||
| public void __exit__() | public void __exit__() | ||||
| { | { | ||||
| throw new NotImplementedException(); | |||||
| } | } | ||||
| public void Dispose() | public void Dispose() | ||||
| { | { | ||||
| throw new NotImplementedException(); | throw new NotImplementedException(); | ||||
| } | } | ||||
| public void __init__() | |||||
| { | |||||
| } | |||||
| public void __del__() | |||||
| { | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -20,7 +20,6 @@ using System.Runtime.InteropServices; | |||||
| using Google.Protobuf; | using Google.Protobuf; | ||||
| using System.Linq; | using System.Linq; | ||||
| using NumSharp; | using NumSharp; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace Tensorflow | namespace Tensorflow | ||||
| @@ -448,7 +447,7 @@ namespace Tensorflow | |||||
| { | { | ||||
| var ret = new List<Tensor>(); | var ret = new List<Tensor>(); | ||||
| foreach(var (i, value) in Python.enumerate(values)) | |||||
| foreach(var (i, value) in enumerate(values)) | |||||
| { | { | ||||
| if (value == null) | if (value == null) | ||||
| { | { | ||||
| @@ -27,7 +27,7 @@ namespace Tensorflow | |||||
| /// <summary> | /// <summary> | ||||
| /// Returns a context manager that creates hierarchical names for operations. | /// Returns a context manager that creates hierarchical names for operations. | ||||
| /// </summary> | /// </summary> | ||||
| public class NameScope : IPython | |||||
| public class NameScope : IObjectLife | |||||
| { | { | ||||
| public string _name; | public string _name; | ||||
| public string _default_name; | public string _default_name; | ||||
| @@ -70,6 +70,16 @@ namespace Tensorflow | |||||
| { | { | ||||
| } | } | ||||
| public void __init__() | |||||
| { | |||||
| } | |||||
| public void __del__() | |||||
| { | |||||
| } | |||||
| /// <summary> | /// <summary> | ||||
| /// __enter__() | /// __enter__() | ||||
| /// </summary> | /// </summary> | ||||
| @@ -18,7 +18,7 @@ using Tensorflow.Eager; | |||||
| namespace Tensorflow | namespace Tensorflow | ||||
| { | { | ||||
| public partial class tensorflow : IPyClass | |||||
| public partial class tensorflow : IObjectLife | |||||
| { | { | ||||
| public TF_DataType @byte = TF_DataType.TF_UINT8; | public TF_DataType @byte = TF_DataType.TF_UINT8; | ||||
| public TF_DataType @sbyte = TF_DataType.TF_INT8; | public TF_DataType @sbyte = TF_DataType.TF_INT8; | ||||
| @@ -78,22 +78,27 @@ namespace Tensorflow | |||||
| return new Session(null, opts); | 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() | |||||
| { | { | ||||
| } | } | ||||
| @@ -39,7 +39,7 @@ let run()= | |||||
| let n_hidden_layer_1 = 25 // Hidden layer 1 | let n_hidden_layer_1 = 25 // Hidden layer 1 | ||||
| let n_hidden_layer_2 = 25 // Hidden layer 2 | let n_hidden_layer_2 = 25 // Hidden layer 2 | ||||
| let tf = Python.New<tensorflow>() | |||||
| let tf = Binding.New<tensorflow>() | |||||
| let x = tf.placeholder(tf.float64, new TensorShape(N_points,n_input)) | let x = tf.placeholder(tf.float64, new TensorShape(N_points,n_input)) | ||||
| let y = tf.placeholder(tf.float64, new TensorShape(n_output)) | let y = tf.placeholder(tf.float64, new TensorShape(n_output)) | ||||
| @@ -77,7 +77,7 @@ let run()= | |||||
| let init = tf.global_variables_initializer() | 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 | sess.run(init) |> ignore | ||||
| // Loop over epochs | // Loop over epochs | ||||
| for epoch in [0..training_epochs] do | for epoch in [0..training_epochs] do | ||||
| @@ -19,7 +19,6 @@ using System; | |||||
| using System.Diagnostics; | using System.Diagnostics; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using Tensorflow.Hub; | using Tensorflow.Hub; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.Examples | namespace TensorFlowNET.Examples | ||||
| @@ -17,7 +17,6 @@ | |||||
| using NumSharp; | using NumSharp; | ||||
| using System; | using System; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.Examples | namespace TensorFlowNET.Examples | ||||
| @@ -20,7 +20,6 @@ using System.Diagnostics; | |||||
| using System.IO; | using System.IO; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using Tensorflow.Hub; | using Tensorflow.Hub; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.Examples | namespace TensorFlowNET.Examples | ||||
| @@ -18,7 +18,6 @@ using NumSharp; | |||||
| using System; | using System; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using Tensorflow.Hub; | using Tensorflow.Hub; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.Examples | namespace TensorFlowNET.Examples | ||||
| @@ -19,7 +19,6 @@ using System.Collections.Generic; | |||||
| using System.Text; | using System.Text; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using TensorFlowDatasets; | using TensorFlowDatasets; | ||||
| using static Tensorflow.Python; | |||||
| namespace TensorFlowNET.Examples | namespace TensorFlowNET.Examples | ||||
| { | { | ||||
| @@ -19,7 +19,6 @@ using System; | |||||
| using System.Diagnostics; | using System.Diagnostics; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using Tensorflow.Hub; | using Tensorflow.Hub; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.Examples | namespace TensorFlowNET.Examples | ||||
| @@ -18,7 +18,6 @@ using NumSharp; | |||||
| using System; | using System; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using Tensorflow.Hub; | using Tensorflow.Hub; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.Examples | namespace TensorFlowNET.Examples | ||||
| @@ -18,7 +18,6 @@ using NumSharp; | |||||
| using System; | using System; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using Tensorflow.Hub; | using Tensorflow.Hub; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.Examples | namespace TensorFlowNET.Examples | ||||
| @@ -23,7 +23,6 @@ using System.IO; | |||||
| using System.Linq; | using System.Linq; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using TensorFlowNET.Examples.Utility; | using TensorFlowNET.Examples.Utility; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.Examples | namespace TensorFlowNET.Examples | ||||
| @@ -24,7 +24,6 @@ using Tensorflow; | |||||
| using Tensorflow.Sessions; | using Tensorflow.Sessions; | ||||
| using TensorFlowNET.Examples.Text; | using TensorFlowNET.Examples.Text; | ||||
| using TensorFlowNET.Examples.Utility; | using TensorFlowNET.Examples.Utility; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.Examples | namespace TensorFlowNET.Examples | ||||
| @@ -6,7 +6,6 @@ using System.Linq; | |||||
| using Tensorflow; | using Tensorflow; | ||||
| using Tensorflow.Estimator; | using Tensorflow.Estimator; | ||||
| using TensorFlowNET.Examples.Utility; | using TensorFlowNET.Examples.Utility; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| using static TensorFlowNET.Examples.DataHelpers; | using static TensorFlowNET.Examples.DataHelpers; | ||||
| @@ -5,7 +5,6 @@ using System.IO; | |||||
| using System.Linq; | using System.Linq; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using TensorFlowNET.Examples.Utility; | using TensorFlowNET.Examples.Utility; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.Examples | namespace TensorFlowNET.Examples | ||||
| @@ -1,5 +1,4 @@ | |||||
| using Tensorflow; | using Tensorflow; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.Examples.Text | namespace TensorFlowNET.Examples.Text | ||||
| @@ -1,7 +1,6 @@ | |||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Linq; | using System.Linq; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.Examples.Text | namespace TensorFlowNET.Examples.Text | ||||
| @@ -16,7 +16,6 @@ | |||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.Examples.Text | namespace TensorFlowNET.Examples.Text | ||||
| @@ -1,5 +1,4 @@ | |||||
| using Microsoft.VisualStudio.TestTools.UnitTesting; | using Microsoft.VisualStudio.TestTools.UnitTesting; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.UnitTest.Basics | namespace TensorFlowNET.UnitTest.Basics | ||||
| @@ -2,7 +2,6 @@ | |||||
| using NumSharp; | using NumSharp; | ||||
| using System.Linq; | using System.Linq; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.UnitTest | namespace TensorFlowNET.UnitTest | ||||
| @@ -1,6 +1,5 @@ | |||||
| using Microsoft.VisualStudio.TestTools.UnitTesting; | using Microsoft.VisualStudio.TestTools.UnitTesting; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.UnitTest | namespace TensorFlowNET.UnitTest | ||||
| @@ -1,6 +1,6 @@ | |||||
| using Microsoft.VisualStudio.TestTools.UnitTesting; | using Microsoft.VisualStudio.TestTools.UnitTesting; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace TensorFlowNET.UnitTest | namespace TensorFlowNET.UnitTest | ||||
| { | { | ||||
| @@ -238,7 +238,7 @@ namespace TensorFlowNET.UnitTest | |||||
| return s.as_default(); | 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): | //def _constrain_devices_and_set_default(self, sess, use_gpu, force_gpu): | ||||
| //"""Set the session and its graph to global default and constrain devices.""" | //"""Set the session and its graph to global default and constrain devices.""" | ||||
| @@ -5,7 +5,6 @@ using System.Linq; | |||||
| using System.Runtime.InteropServices; | using System.Runtime.InteropServices; | ||||
| using System.Threading; | using System.Threading; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.UnitTest | namespace TensorFlowNET.UnitTest | ||||
| @@ -1,7 +1,6 @@ | |||||
| using Microsoft.VisualStudio.TestTools.UnitTesting; | using Microsoft.VisualStudio.TestTools.UnitTesting; | ||||
| using System; | using System; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.UnitTest | namespace TensorFlowNET.UnitTest | ||||
| @@ -1,6 +1,5 @@ | |||||
| using Microsoft.VisualStudio.TestTools.UnitTesting; | using Microsoft.VisualStudio.TestTools.UnitTesting; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.UnitTest | namespace TensorFlowNET.UnitTest | ||||
| @@ -1,7 +1,6 @@ | |||||
| using System; | using System; | ||||
| using Microsoft.VisualStudio.TestTools.UnitTesting; | using Microsoft.VisualStudio.TestTools.UnitTesting; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.UnitTest.control_flow_ops_test | namespace TensorFlowNET.UnitTest.control_flow_ops_test | ||||
| @@ -6,7 +6,6 @@ using Newtonsoft.Json.Linq; | |||||
| using NumSharp; | using NumSharp; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using Tensorflow.Util; | using Tensorflow.Util; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.UnitTest.nest_test | namespace TensorFlowNET.UnitTest.nest_test | ||||
| @@ -3,7 +3,7 @@ using System.Linq; | |||||
| using Microsoft.VisualStudio.TestTools.UnitTesting; | using Microsoft.VisualStudio.TestTools.UnitTesting; | ||||
| using NumSharp; | using NumSharp; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | |||||
| namespace TensorFlowNET.UnitTest.nn_test | namespace TensorFlowNET.UnitTest.nn_test | ||||
| { | { | ||||
| @@ -3,7 +3,6 @@ using System.Linq; | |||||
| using Microsoft.VisualStudio.TestTools.UnitTesting; | using Microsoft.VisualStudio.TestTools.UnitTesting; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using Tensorflow.Eager; | using Tensorflow.Eager; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.UnitTest.ops_test | namespace TensorFlowNET.UnitTest.ops_test | ||||
| @@ -3,7 +3,6 @@ using System.Linq; | |||||
| using Microsoft.VisualStudio.TestTools.UnitTesting; | using Microsoft.VisualStudio.TestTools.UnitTesting; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| using Tensorflow.Operations; | using Tensorflow.Operations; | ||||
| using static Tensorflow.Python; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace TensorFlowNET.UnitTest.ops_test | namespace TensorFlowNET.UnitTest.ops_test | ||||