Browse Source

Merge Tensorflow.Python into Tensorflow.Binding.

tags/v0.12
Oceania2018 6 years ago
parent
commit
226720dd88
89 changed files with 177 additions and 135 deletions
  1. +2
    -2
      src/TensorFlowNET.Core/APIs/tf.nn.cs
  2. +20
    -27
      src/TensorFlowNET.Core/Binding.Util.cs
  3. +2
    -2
      src/TensorFlowNET.Core/Binding.cs
  4. +1
    -1
      src/TensorFlowNET.Core/Clustering/_InitializeClustersOpFactory.cs
  5. +1
    -1
      src/TensorFlowNET.Core/Framework/graph_util_impl.cs
  6. +1
    -1
      src/TensorFlowNET.Core/Framework/importer.py.cs
  7. +0
    -1
      src/TensorFlowNET.Core/Gradients/array_grad.cs
  8. +1
    -1
      src/TensorFlowNET.Core/Gradients/gradients_util.cs
  9. +0
    -1
      src/TensorFlowNET.Core/Gradients/math_grad.cs
  10. +2
    -1
      src/TensorFlowNET.Core/Graphs/Graph.cs
  11. +12
    -2
      src/TensorFlowNET.Core/Graphs/_ControlDependenciesController.cs
  12. +7
    -5
      src/TensorFlowNET.Core/IObjectLife.cs
  13. +1
    -1
      src/TensorFlowNET.Core/Keras/BackendBase.cs
  14. +11
    -1
      src/TensorFlowNET.Core/Keras/Engine/Sequential.cs
  15. +2
    -2
      src/TensorFlowNET.Core/Keras/Layers/BatchNormalization.cs
  16. +0
    -1
      src/TensorFlowNET.Core/Keras/Layers/Layer.cs
  17. +0
    -1
      src/TensorFlowNET.Core/Keras/backend.cs
  18. +0
    -1
      src/TensorFlowNET.Core/Layers/Layer.cs
  19. +1
    -1
      src/TensorFlowNET.Core/Operations/ControlFlows/CondContext.cs
  20. +10
    -1
      src/TensorFlowNET.Core/Operations/ControlFlows/ControlFlowContext.cs
  21. +1
    -1
      src/TensorFlowNET.Core/Operations/ControlFlows/WhileContext.cs
  22. +1
    -1
      src/TensorFlowNET.Core/Operations/Distributions/distribution.py.cs
  23. +0
    -1
      src/TensorFlowNET.Core/Operations/Distributions/normal.py.cs
  24. +1
    -1
      src/TensorFlowNET.Core/Operations/Losses/losses_impl.py.cs
  25. +1
    -1
      src/TensorFlowNET.Core/Operations/NnOps/MaxPoolFunction.cs
  26. +0
    -1
      src/TensorFlowNET.Core/Operations/NnOps/rnn.cs
  27. +1
    -1
      src/TensorFlowNET.Core/Operations/OpDefLibrary.cs
  28. +1
    -1
      src/TensorFlowNET.Core/Operations/RNNCell.cs
  29. +1
    -1
      src/TensorFlowNET.Core/Operations/_GraphTensorArray.cs
  30. +0
    -1
      src/TensorFlowNET.Core/Operations/array_ops.py.cs
  31. +1
    -1
      src/TensorFlowNET.Core/Operations/check_ops.cs
  32. +1
    -1
      src/TensorFlowNET.Core/Operations/confusion_matrix.py.cs
  33. +1
    -1
      src/TensorFlowNET.Core/Operations/control_flow_ops.py.cs
  34. +1
    -1
      src/TensorFlowNET.Core/Operations/embedding_ops.cs
  35. +0
    -1
      src/TensorFlowNET.Core/Operations/gen_image_ops.py.cs
  36. +1
    -1
      src/TensorFlowNET.Core/Operations/math_ops.cs
  37. +1
    -1
      src/TensorFlowNET.Core/Operations/nn_impl.py.cs
  38. +2
    -2
      src/TensorFlowNET.Core/Operations/nn_ops.cs
  39. +1
    -1
      src/TensorFlowNET.Core/Operations/random_ops.py.cs
  40. +1
    -1
      src/TensorFlowNET.Core/Operations/weights_broadcast_ops.cs
  41. +11
    -1
      src/TensorFlowNET.Core/Sessions/Session.cs
  42. +1
    -1
      src/TensorFlowNET.Core/Summaries/Summary.cs
  43. +1
    -1
      src/TensorFlowNET.Core/Tensors/Tensor.Operators.cs
  44. +1
    -1
      src/TensorFlowNET.Core/Tensors/Tensor.cs
  45. +1
    -1
      src/TensorFlowNET.Core/Train/AdamOptimizer.cs
  46. +1
    -2
      src/TensorFlowNET.Core/Train/Optimizer.cs
  47. +1
    -1
      src/TensorFlowNET.Core/Train/Saving/BaseSaverBuilder.cs
  48. +1
    -2
      src/TensorFlowNET.Core/Train/Saving/Saver.cs
  49. +1
    -1
      src/TensorFlowNET.Core/Train/Saving/saveable_object_util.py.cs
  50. +0
    -1
      src/TensorFlowNET.Core/Train/SlotCreator.cs
  51. +2
    -2
      src/TensorFlowNET.Core/Util/nest.py.cs
  52. +11
    -1
      src/TensorFlowNET.Core/Variables/PureVariableScope.cs
  53. +1
    -1
      src/TensorFlowNET.Core/Variables/RefVariable.Operators.cs
  54. +1
    -1
      src/TensorFlowNET.Core/Variables/RefVariable.cs
  55. +1
    -1
      src/TensorFlowNET.Core/Variables/VariableScope.cs
  56. +11
    -1
      src/TensorFlowNET.Core/Variables/variable_scope.py.cs
  57. +13
    -3
      src/TensorFlowNET.Core/ops._DefaultStack.cs
  58. +1
    -2
      src/TensorFlowNET.Core/ops.cs
  59. +11
    -1
      src/TensorFlowNET.Core/ops.name_scope.cs
  60. +10
    -5
      src/TensorFlowNET.Core/tensorflow.cs
  61. +2
    -2
      test/TensorFlowNET.Examples.FSharp/FunctionApproximation.fs
  62. +0
    -1
      test/TensorFlowNET.Examples/BasicModels/KMeansClustering.cs
  63. +0
    -1
      test/TensorFlowNET.Examples/BasicModels/LinearRegression.cs
  64. +0
    -1
      test/TensorFlowNET.Examples/BasicModels/LogisticRegression.cs
  65. +0
    -1
      test/TensorFlowNET.Examples/BasicModels/NearestNeighbor.cs
  66. +0
    -1
      test/TensorFlowNET.Examples/ImageProcessing/CIFAR10-CNN.cs
  67. +0
    -1
      test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionCNN.cs
  68. +0
    -1
      test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionNN.cs
  69. +0
    -1
      test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionRNN.cs
  70. +0
    -1
      test/TensorFlowNET.Examples/ImageProcessing/RetrainImageClassifier.cs
  71. +0
    -1
      test/TensorFlowNET.Examples/TextProcessing/CnnTextClassification.cs
  72. +0
    -1
      test/TensorFlowNET.Examples/TextProcessing/NER/LstmCrfNer.cs
  73. +0
    -1
      test/TensorFlowNET.Examples/TextProcessing/Word2Vec.cs
  74. +0
    -1
      test/TensorFlowNET.Examples/TextProcessing/cnn_models/CharCnn.cs
  75. +0
    -1
      test/TensorFlowNET.Examples/TextProcessing/cnn_models/VdCnn.cs
  76. +0
    -1
      test/TensorFlowNET.Examples/TextProcessing/cnn_models/WordCnn.cs
  77. +0
    -1
      test/TensorFlowNET.UnitTest/Basics/AssignTests.cs
  78. +0
    -1
      test/TensorFlowNET.UnitTest/GradientTest.cs
  79. +0
    -1
      test/TensorFlowNET.UnitTest/NameScopeTest.cs
  80. +1
    -1
      test/TensorFlowNET.UnitTest/PythonBaseTests.cs
  81. +1
    -1
      test/TensorFlowNET.UnitTest/PythonTest.cs
  82. +0
    -1
      test/TensorFlowNET.UnitTest/TensorTest.cs
  83. +0
    -1
      test/TensorFlowNET.UnitTest/TrainSaverTest.cs
  84. +0
    -1
      test/TensorFlowNET.UnitTest/VariableTest.cs
  85. +0
    -1
      test/TensorFlowNET.UnitTest/control_flow_ops_test/WhileContextTestCase.cs
  86. +0
    -1
      test/TensorFlowNET.UnitTest/nest_test/NestTest.cs
  87. +1
    -1
      test/TensorFlowNET.UnitTest/nn_test/ZeroFractionTest.cs
  88. +0
    -1
      test/TensorFlowNET.UnitTest/ops_test/ControlDependenciesTest.cs
  89. +0
    -1
      test/TensorFlowNET.UnitTest/ops_test/CreateOpFromTfOperationTest.cs

+ 2
- 2
src/TensorFlowNET.Core/APIs/tf.nn.cs View File

@@ -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);


src/TensorFlowNET.Core/Python.cs → src/TensorFlowNET.Core/Binding.Util.cs View File

@@ -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__();
}
} }

+ 2
- 2
src/TensorFlowNET.Core/Binding.cs View File

@@ -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>();
} }
} }

+ 1
- 1
src/TensorFlowNET.Core/Clustering/_InitializeClustersOpFactory.cs View File

@@ -15,7 +15,7 @@
******************************************************************************/ ******************************************************************************/


using System.Linq; using System.Linq;
using static Tensorflow.Python;
using static Tensorflow.Binding;


namespace Tensorflow.Clustering namespace Tensorflow.Clustering
{ {


+ 1
- 1
src/TensorFlowNET.Core/Framework/graph_util_impl.cs View File

@@ -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
{ {


+ 1
- 1
src/TensorFlowNET.Core/Framework/importer.py.cs View File

@@ -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
{ {


+ 0
- 1
src/TensorFlowNET.Core/Gradients/array_grad.cs View File

@@ -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


+ 1
- 1
src/TensorFlowNET.Core/Gradients/gradients_util.cs View File

@@ -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
{ {


+ 0
- 1
src/TensorFlowNET.Core/Gradients/math_grad.cs View File

@@ -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


+ 2
- 1
src/TensorFlowNET.Core/Graphs/Graph.cs View File

@@ -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))
{ {


} }


+ 12
- 2
src/TensorFlowNET.Core/Graphs/_ControlDependenciesController.cs View File

@@ -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__()
{
}
} }
} }

src/TensorFlowNET.Core/IPyClass.cs → src/TensorFlowNET.Core/IObjectLife.cs View File

@@ -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__();
} }
} }

+ 1
- 1
src/TensorFlowNET.Core/Keras/BackendBase.cs View File

@@ -15,7 +15,7 @@
******************************************************************************/ ******************************************************************************/


using System; using System;
using static Tensorflow.Python;
using static Tensorflow.Binding;


namespace Tensorflow.Keras namespace Tensorflow.Keras
{ {


+ 11
- 1
src/TensorFlowNET.Core/Keras/Engine/Sequential.cs View File

@@ -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__()
{
}
} }
} }

+ 2
- 2
src/TensorFlowNET.Core/Keras/Layers/BatchNormalization.cs View File

@@ -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");


+ 0
- 1
src/TensorFlowNET.Core/Keras/Layers/Layer.cs View File

@@ -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


+ 0
- 1
src/TensorFlowNET.Core/Keras/backend.cs View File

@@ -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


+ 0
- 1
src/TensorFlowNET.Core/Layers/Layer.cs View File

@@ -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


+ 1
- 1
src/TensorFlowNET.Core/Operations/ControlFlows/CondContext.cs View File

@@ -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
{ {


+ 10
- 1
src/TensorFlowNET.Core/Operations/ControlFlows/ControlFlowContext.cs View File

@@ -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__()
{
}
} }
} }

+ 1
- 1
src/TensorFlowNET.Core/Operations/ControlFlows/WhileContext.cs View File

@@ -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
{ {


+ 1
- 1
src/TensorFlowNET.Core/Operations/Distributions/distribution.py.cs View File

@@ -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


+ 0
- 1
src/TensorFlowNET.Core/Operations/Distributions/normal.py.cs View File

@@ -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


+ 1
- 1
src/TensorFlowNET.Core/Operations/Losses/losses_impl.py.cs View File

@@ -15,7 +15,7 @@
******************************************************************************/ ******************************************************************************/


using System; using System;
using static Tensorflow.Python;
using static Tensorflow.Binding;


namespace Tensorflow namespace Tensorflow
{ {


+ 1
- 1
src/TensorFlowNET.Core/Operations/NnOps/MaxPoolFunction.cs View File

@@ -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
{ {


+ 0
- 1
src/TensorFlowNET.Core/Operations/NnOps/rnn.cs View File

@@ -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;




+ 1
- 1
src/TensorFlowNET.Core/Operations/OpDefLibrary.cs View File

@@ -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
{ {


+ 1
- 1
src/TensorFlowNET.Core/Operations/RNNCell.cs View File

@@ -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
{ {


+ 1
- 1
src/TensorFlowNET.Core/Operations/_GraphTensorArray.cs View File

@@ -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
{ {


+ 0
- 1
src/TensorFlowNET.Core/Operations/array_ops.py.cs View File

@@ -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


+ 1
- 1
src/TensorFlowNET.Core/Operations/check_ops.cs View File

@@ -14,7 +14,7 @@
limitations under the License. limitations under the License.
******************************************************************************/ ******************************************************************************/


using static Tensorflow.Python;
using static Tensorflow.Binding;


namespace Tensorflow namespace Tensorflow
{ {


+ 1
- 1
src/TensorFlowNET.Core/Operations/confusion_matrix.py.cs View File

@@ -15,7 +15,7 @@
******************************************************************************/ ******************************************************************************/


using System; using System;
using static Tensorflow.Python;
using static Tensorflow.Binding;


namespace Tensorflow namespace Tensorflow
{ {


+ 1
- 1
src/TensorFlowNET.Core/Operations/control_flow_ops.py.cs View File

@@ -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
{ {


+ 1
- 1
src/TensorFlowNET.Core/Operations/embedding_ops.cs View File

@@ -15,7 +15,7 @@
******************************************************************************/ ******************************************************************************/


using System; using System;
using static Tensorflow.Python;
using static Tensorflow.Binding;


namespace Tensorflow namespace Tensorflow
{ {


+ 0
- 1
src/TensorFlowNET.Core/Operations/gen_image_ops.py.cs View File

@@ -15,7 +15,6 @@
******************************************************************************/ ******************************************************************************/


using System; using System;
using static Tensorflow.Python;
using static Tensorflow.Binding; using static Tensorflow.Binding;


namespace Tensorflow namespace Tensorflow


+ 1
- 1
src/TensorFlowNET.Core/Operations/math_ops.cs View File

@@ -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
{ {


+ 1
- 1
src/TensorFlowNET.Core/Operations/nn_impl.py.cs View File

@@ -15,7 +15,7 @@
******************************************************************************/ ******************************************************************************/


using Tensorflow.Operations; using Tensorflow.Operations;
using static Tensorflow.Python;
using static Tensorflow.Binding;


namespace Tensorflow namespace Tensorflow
{ {


+ 2
- 2
src/TensorFlowNET.Core/Operations/nn_ops.cs View File

@@ -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");


+ 1
- 1
src/TensorFlowNET.Core/Operations/random_ops.py.cs View File

@@ -14,7 +14,7 @@
limitations under the License. limitations under the License.
******************************************************************************/ ******************************************************************************/


using static Tensorflow.Python;
using static Tensorflow.Binding;


namespace Tensorflow namespace Tensorflow
{ {


+ 1
- 1
src/TensorFlowNET.Core/Operations/weights_broadcast_ops.cs View File

@@ -14,7 +14,7 @@
limitations under the License. limitations under the License.
******************************************************************************/ ******************************************************************************/


using static Tensorflow.Python;
using static Tensorflow.Binding;


namespace Tensorflow namespace Tensorflow
{ {


+ 11
- 1
src/TensorFlowNET.Core/Sessions/Session.cs View File

@@ -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__()
{
}
} }
} }

+ 1
- 1
src/TensorFlowNET.Core/Summaries/Summary.cs View File

@@ -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
{ {


+ 1
- 1
src/TensorFlowNET.Core/Tensors/Tensor.Operators.cs View File

@@ -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
{ {


+ 1
- 1
src/TensorFlowNET.Core/Tensors/Tensor.cs View File

@@ -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
{ {


+ 1
- 1
src/TensorFlowNET.Core/Train/AdamOptimizer.cs View File

@@ -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
{ {


+ 1
- 2
src/TensorFlowNET.Core/Train/Optimizer.cs View File

@@ -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();




+ 1
- 1
src/TensorFlowNET.Core/Train/Saving/BaseSaverBuilder.cs View File

@@ -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
{ {


+ 1
- 2
src/TensorFlowNET.Core/Train/Saving/Saver.cs View File

@@ -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()


+ 1
- 1
src/TensorFlowNET.Core/Train/Saving/saveable_object_util.py.cs View File

@@ -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
{ {


+ 0
- 1
src/TensorFlowNET.Core/Train/SlotCreator.cs View File

@@ -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


+ 2
- 2
src/TensorFlowNET.Core/Util/nest.py.cs View File

@@ -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."""


+ 11
- 1
src/TensorFlowNET.Core/Variables/PureVariableScope.cs View File

@@ -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;


+ 1
- 1
src/TensorFlowNET.Core/Variables/RefVariable.Operators.cs View File

@@ -14,7 +14,7 @@
limitations under the License. limitations under the License.
******************************************************************************/ ******************************************************************************/


using static Tensorflow.Python;
using static Tensorflow.Binding;


namespace Tensorflow namespace Tensorflow
{ {


+ 1
- 1
src/TensorFlowNET.Core/Variables/RefVariable.cs View File

@@ -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
{ {


+ 1
- 1
src/TensorFlowNET.Core/Variables/VariableScope.cs View File

@@ -14,7 +14,7 @@
limitations under the License. limitations under the License.
******************************************************************************/ ******************************************************************************/


using static Tensorflow.Python;
using static Tensorflow.Binding;


namespace Tensorflow namespace Tensorflow
{ {


+ 11
- 1
src/TensorFlowNET.Core/Variables/variable_scope.py.cs View File

@@ -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__()
{
}
} }
} }

+ 13
- 3
src/TensorFlowNET.Core/ops._DefaultStack.cs View File

@@ -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__()
{
}
} }
} }
} }

src/TensorFlowNET.Core/ops.py.cs → src/TensorFlowNET.Core/ops.cs View File

@@ -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)
{ {

+ 11
- 1
src/TensorFlowNET.Core/ops.name_scope.cs View File

@@ -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>


+ 10
- 5
src/TensorFlowNET.Core/tensorflow.cs View File

@@ -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()
{ {
} }


+ 2
- 2
test/TensorFlowNET.Examples.FSharp/FunctionApproximation.fs View File

@@ -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


+ 0
- 1
test/TensorFlowNET.Examples/BasicModels/KMeansClustering.cs View File

@@ -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


+ 0
- 1
test/TensorFlowNET.Examples/BasicModels/LinearRegression.cs View File

@@ -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


+ 0
- 1
test/TensorFlowNET.Examples/BasicModels/LogisticRegression.cs View File

@@ -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


+ 0
- 1
test/TensorFlowNET.Examples/BasicModels/NearestNeighbor.cs View File

@@ -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


+ 0
- 1
test/TensorFlowNET.Examples/ImageProcessing/CIFAR10-CNN.cs View File

@@ -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
{ {


+ 0
- 1
test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionCNN.cs View File

@@ -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


+ 0
- 1
test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionNN.cs View File

@@ -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


+ 0
- 1
test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionRNN.cs View File

@@ -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


+ 0
- 1
test/TensorFlowNET.Examples/ImageProcessing/RetrainImageClassifier.cs View File

@@ -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


+ 0
- 1
test/TensorFlowNET.Examples/TextProcessing/CnnTextClassification.cs View File

@@ -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


+ 0
- 1
test/TensorFlowNET.Examples/TextProcessing/NER/LstmCrfNer.cs View File

@@ -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;




+ 0
- 1
test/TensorFlowNET.Examples/TextProcessing/Word2Vec.cs View File

@@ -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


+ 0
- 1
test/TensorFlowNET.Examples/TextProcessing/cnn_models/CharCnn.cs View File

@@ -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


+ 0
- 1
test/TensorFlowNET.Examples/TextProcessing/cnn_models/VdCnn.cs View File

@@ -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


+ 0
- 1
test/TensorFlowNET.Examples/TextProcessing/cnn_models/WordCnn.cs View File

@@ -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


+ 0
- 1
test/TensorFlowNET.UnitTest/Basics/AssignTests.cs View File

@@ -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


+ 0
- 1
test/TensorFlowNET.UnitTest/GradientTest.cs View File

@@ -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


+ 0
- 1
test/TensorFlowNET.UnitTest/NameScopeTest.cs View File

@@ -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
- 1
test/TensorFlowNET.UnitTest/PythonBaseTests.cs View File

@@ -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
{ {


+ 1
- 1
test/TensorFlowNET.UnitTest/PythonTest.cs View File

@@ -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."""


+ 0
- 1
test/TensorFlowNET.UnitTest/TensorTest.cs View File

@@ -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


+ 0
- 1
test/TensorFlowNET.UnitTest/TrainSaverTest.cs View File

@@ -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


+ 0
- 1
test/TensorFlowNET.UnitTest/VariableTest.cs View File

@@ -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


+ 0
- 1
test/TensorFlowNET.UnitTest/control_flow_ops_test/WhileContextTestCase.cs View File

@@ -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


+ 0
- 1
test/TensorFlowNET.UnitTest/nest_test/NestTest.cs View File

@@ -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


+ 1
- 1
test/TensorFlowNET.UnitTest/nn_test/ZeroFractionTest.cs View File

@@ -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
{ {


+ 0
- 1
test/TensorFlowNET.UnitTest/ops_test/ControlDependenciesTest.cs View File

@@ -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


+ 0
- 1
test/TensorFlowNET.UnitTest/ops_test/CreateOpFromTfOperationTest.cs View File

@@ -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


Loading…
Cancel
Save