Browse Source

restructure dir and namespace

tags/v0.1.0-Tensor
Oceania2018 7 years ago
parent
commit
91f42b3e3e
23 changed files with 53 additions and 58 deletions
  1. +1
    -2
      src/TensorFlowNET.Core/BaseSession.cs
  2. +1
    -2
      src/TensorFlowNET.Core/Buffer.cs
  3. +1
    -1
      src/TensorFlowNET.Core/Eager/Context.cs
  4. +1
    -2
      src/TensorFlowNET.Core/Graph.cs
  5. +1
    -1
      src/TensorFlowNET.Core/MonoPInvokeCallbackAttribute.cs
  6. +5
    -4
      src/TensorFlowNET.Core/OpDefLibrary.cs
  7. +1
    -2
      src/TensorFlowNET.Core/Operation.cs
  8. +1
    -1
      src/TensorFlowNET.Core/Session.cs
  9. +1
    -2
      src/TensorFlowNET.Core/Status.cs
  10. +1
    -2
      src/TensorFlowNET.Core/Tensor.cs
  11. +2
    -0
      src/TensorFlowNET.Core/TensorFlowNET.Core.csproj
  12. +1
    -3
      src/TensorFlowNET.Core/TensorShape.cs
  13. +0
    -13
      src/TensorFlowNET.Core/Tensorflow/TF_Graph.cs
  14. +3
    -5
      src/TensorFlowNET.Core/c_api.cs
  15. +1
    -2
      src/TensorFlowNET.Core/ops.cs
  16. +3
    -2
      src/TensorFlowNET.Core/ops/gen_array_ops.cs
  17. +15
    -0
      src/TensorFlowNET.Core/ops/gen_math_ops.cs
  18. +2
    -3
      src/TensorFlowNET.Core/tensor_util.cs
  19. +7
    -6
      src/TensorFlowNET.Core/tf.cs
  20. +1
    -1
      test/TensorFlowNET.Examples/HelloWorld.cs
  21. +1
    -1
      test/TensorFlowNET.UnitTest/GraphTest.cs
  22. +1
    -1
      test/TensorFlowNET.UnitTest/OperationsTest.cs
  23. +2
    -2
      test/TensorFlowNET.UnitTest/VersionTest.cs

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

@@ -1,9 +1,8 @@
using System;
using System.Collections.Generic;
using System.Text;
using Tensorflow;

namespace TensorFlowNET.Core
namespace Tensorflow
{
public class BaseSession
{


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

@@ -2,9 +2,8 @@
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using Tensorflow;

namespace TensorFlowNET.Core
namespace Tensorflow
{
public class Buffer
{


+ 1
- 1
src/TensorFlowNET.Core/Eager/Context.cs View File

@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;

namespace TensorFlowNET.Core.Eager
namespace Tensorflow.Eager
{
public class Context
{


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

@@ -3,10 +3,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Tensorflow;
using TF_DataType = Tensorflow.DataType;

namespace TensorFlowNET.Core
namespace Tensorflow
{
/// <summary>
/// TensorFlow uses a dataflow graph to represent your computation in terms of the dependencies between individual operations.


+ 1
- 1
src/TensorFlowNET.Core/MonoPInvokeCallbackAttribute.cs View File

@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;

namespace TensorFlowNET.Core
namespace Tensorflow
{
public sealed class MonoPInvokeCallbackAttribute : Attribute
{


+ 5
- 4
src/TensorFlowNET.Core/OpDefLibrary.cs View File

@@ -3,10 +3,9 @@ using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using Tensorflow;
using static Tensorflow.OpDef.Types;

namespace TensorFlowNET.Core
namespace Tensorflow
{
public class OpDefLibrary
{
@@ -39,7 +38,9 @@ namespace TensorFlowNET.Core
name = op_type_name;
}

foreach(var attr_def in op_def.Attr)
string scope = g.unique_name(name) + "/";

foreach (var attr_def in op_def.Attr)
{
if (attr_def.Type != "type") continue;
var key = attr_def.Name;
@@ -84,7 +85,7 @@ namespace TensorFlowNET.Core
}

var op = g.create_op(op_type_name, null, output_types.ToArray(),
name: "Placeholder_1/",
name: scope,
input_types: new DataType[] { },
attrs: attr_protos,
op_def: op_def);


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

@@ -1,10 +1,9 @@
using System;
using System.Collections.Generic;
using System.Text;
using Tensorflow;
using TF_DataType = Tensorflow.DataType;

namespace TensorFlowNET.Core
namespace Tensorflow
{
public class Operation
{


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

@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;

namespace TensorFlowNET.Core
namespace Tensorflow
{
public class Session : BaseSession
{


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

@@ -1,9 +1,8 @@
using System;
using System.Collections.Generic;
using System.Text;
using Tensorflow;

namespace TensorFlowNET.Core
namespace Tensorflow
{
public class Status
{


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

@@ -1,9 +1,8 @@
using System;
using System.Collections.Generic;
using System.Text;
using Tensorflow;

namespace TensorFlowNET.Core
namespace Tensorflow
{
public class Tensor
{


+ 2
- 0
src/TensorFlowNET.Core/TensorFlowNET.Core.csproj View File

@@ -2,6 +2,8 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>TensorFlow.NET</AssemblyName>
<RootNamespace>Tensorflow</RootNamespace>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">


+ 1
- 3
src/TensorFlowNET.Core/TensorShape.cs View File

@@ -3,10 +3,8 @@ using NumSharp.Core;
using System;
using System.Collections.Generic;
using System.Text;
using Tensorflow;
using tensor_shape_pb2 = Tensorflow;

namespace TensorFlowNET.Core
namespace Tensorflow
{
public class TensorShape : Shape
{


+ 0
- 13
src/TensorFlowNET.Core/Tensorflow/TF_Graph.cs View File

@@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;

namespace Tensorflow
{
[StructLayout(LayoutKind.Sequential)]
public struct TF_Graph
{

}
}

+ 3
- 5
src/TensorFlowNET.Core/c_api.cs View File

@@ -12,10 +12,8 @@ using TF_Session = System.IntPtr;
using TF_SessionOptions = System.IntPtr;

using TF_DataType = Tensorflow.DataType;
using Tensorflow;
using static TensorFlowNET.Core.tf;

namespace TensorFlowNET.Core
namespace Tensorflow
{
public static class c_api
{
@@ -40,7 +38,7 @@ namespace TensorFlowNET.Core
public static extern unsafe string TF_Message(TF_Status s);

[DllImport(TensorFlowLibName)]
public static unsafe extern IntPtr TF_NewGraph();
public static unsafe extern TF_Graph TF_NewGraph();

[DllImport(TensorFlowLibName)]
public static unsafe extern TF_OperationDescription TF_NewOperation(TF_Graph graph, string opType, string oper_name);
@@ -49,7 +47,7 @@ namespace TensorFlowNET.Core
public static unsafe extern TF_Status TF_NewStatus();

[DllImport(TensorFlowLibName)]
public static extern unsafe TF_Tensor TF_NewTensor(TF_DataType dataType, Int64 dims, int num_dims, IntPtr data, size_t len, Deallocator deallocator, IntPtr deallocator_arg);
public static extern unsafe TF_Tensor TF_NewTensor(TF_DataType dataType, Int64 dims, int num_dims, IntPtr data, size_t len, tf.Deallocator deallocator, IntPtr deallocator_arg);

[DllImport(TensorFlowLibName)]
public static extern unsafe int TF_OperationNumOutputs(TF_Operation oper);


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

@@ -4,11 +4,10 @@ using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using Tensorflow;
using tf = TensorFlowNET.Core.tf;
using node_def_pb2 = Tensorflow;
using Google.Protobuf;

namespace TensorFlowNET.Core
namespace Tensorflow
{
public static class ops
{


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

@@ -4,7 +4,7 @@ using System.IO;
using System.Text;
using Tensorflow;

namespace TensorFlowNET.Core
namespace Tensorflow
{
public static class gen_array_ops
{
@@ -20,7 +20,8 @@ namespace TensorFlowNET.Core
_attrs["dtype"] = _op.get_attr("dtype");
_attrs["shape"] = _op.get_attr("shape");

return null;
var tensor = new Tensor(_op, 0, dtype);
return tensor;
}

private static OpDefLibrary _InitOpDefLibrary()

+ 15
- 0
src/TensorFlowNET.Core/ops/gen_math_ops.cs View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Tensorflow
{
public static class gen_math_ops
{
public static Tensor add(Tensor a, Tensor b, string name = "")
{

return null;
}
}
}

+ 2
- 3
src/TensorFlowNET.Core/tensor_util.cs View File

@@ -2,10 +2,9 @@
using System;
using System.Collections.Generic;
using System.Text;
using Tensorflow;
using tensor_pb2 = Tensorflow;

namespace TensorFlowNET.Core
namespace Tensorflow
{
public static class tensor_util
{
@@ -13,7 +12,7 @@ namespace TensorFlowNET.Core
{
NDArray nparray;
TensorProto tensor_proto = null;
TensorShape tensor_shape = new TensorShape();
TensorShape tensor_shape = new TensorShape(0);

switch (values)
{


+ 7
- 6
src/TensorFlowNET.Core/tf.cs View File

@@ -4,10 +4,9 @@ using System.Runtime.InteropServices;
using System.Text;
using TF_DataType = Tensorflow.DataType;
using attr_value_pb2 = Tensorflow;
using Tensorflow;
using TensorFlowNET.Core.Eager;
using Tensorflow.Eager;

namespace TensorFlowNET.Core
namespace Tensorflow
{
public static class tf
{
@@ -26,12 +25,14 @@ namespace TensorFlowNET.Core

public static unsafe Tensor placeholder(DataType dtype, TensorShape shape = null)
{
var g = ops.get_default_graph();
/*var g = ops.get_default_graph();
var op = new Operation(g, "Placeholder", "feed");

var tensor = new Tensor(op, 0, dtype);
//return gen_array_ops.placeholder(dtype, shape);
return tensor;
return tensor;*/

return gen_array_ops.placeholder(dtype, shape);
}

public static unsafe Tensor constant(object value)


+ 1
- 1
test/TensorFlowNET.Examples/HelloWorld.cs View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using tf = TensorFlowNET.Core.tf;
using Tensorflow;

namespace TensorFlowNET.Examples
{


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

@@ -2,7 +2,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using TensorFlowNET.Core;
using Tensorflow;

namespace TensorFlowNET.UnitTest
{


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

@@ -2,7 +2,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using TensorFlowNET.Core;
using Tensorflow;

namespace TensorFlowNET.UnitTest
{


+ 2
- 2
test/TensorFlowNET.UnitTest/VersionTest.cs View File

@@ -2,7 +2,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using TensorFlowNET.Core;
using Tensorflow;

namespace TensorFlowNET.UnitTest
{
@@ -13,7 +13,7 @@ namespace TensorFlowNET.UnitTest
public void GetVersion()
{
var ver = tf.VERSION;
Assert.IsTrue(ver.Contains("."));
Assert.IsTrue(ver.StartsWith("1."));
}
}
}

Loading…
Cancel
Save