Browse Source

Merge pull request #92 from Esther2013/master

remove op_list_proto_array and op_list_proto_math
tags/v0.1.0-Tensor
Haiping GitHub 6 years ago
parent
commit
0d2ac12a8a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 3 additions and 46 deletions
  1. +1
    -17
      src/TensorFlowNET.Core/Operations/OpDefLibrary.cs
  2. +1
    -11
      src/TensorFlowNET.Core/Operations/gen_array_ops.cs
  3. +1
    -12
      src/TensorFlowNET.Core/Operations/gen_math_ops.cs
  4. BIN
      src/TensorFlowNET.Core/Operations/op_list_proto_array.bin
  5. BIN
      src/TensorFlowNET.Core/Operations/op_list_proto_math.bin
  6. +0
    -6
      src/TensorFlowNET.Core/TensorFlowNET.Core.csproj

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

@@ -9,26 +9,10 @@ namespace Tensorflow
{
public class OpDefLibrary
{
public Dictionary<string, OpDef> _ops = new Dictionary<string, OpDef>();

public void add_op_list(OpList op_list)
{
foreach(var op_def in op_list.Op)
{
add_op(op_def);
}
}

public void add_op(OpDef op_def)
{
_ops[op_def.Name] = op_def;
}

public unsafe Operation _apply_op_helper(string op_type_name, string name = "", Dictionary<string, object> keywords = null)
{
var op_def = _ops[op_type_name];

var g = ops.get_default_graph();
var op_def = g.GetOpDef(op_type_name);

if (String.IsNullOrEmpty(name))
{


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

@@ -8,7 +8,7 @@ namespace Tensorflow
{
public static class gen_array_ops
{
public static OpDefLibrary _op_def_lib = _InitOpDefLibrary();
public static OpDefLibrary _op_def_lib = new OpDefLibrary();

public static Tensor placeholder(TF_DataType dtype, TensorShape shape = null)
{
@@ -34,15 +34,5 @@ namespace Tensorflow
var tensor = new Tensor(_op, 0, dtype);
return tensor;
}

private static OpDefLibrary _InitOpDefLibrary()
{
var bytes = File.ReadAllBytes("Operations/op_list_proto_array.bin");
var op_list = OpList.Parser.ParseFrom(bytes);
var op_def_lib = new OpDefLibrary();
op_def_lib.add_op_list(op_list);

return op_def_lib;
}
}
}

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

@@ -7,7 +7,7 @@ namespace Tensorflow
{
public static class gen_math_ops
{
public static OpDefLibrary _op_def_lib = _InitOpDefLibrary();
public static OpDefLibrary _op_def_lib = new OpDefLibrary();

public static Tensor add(Tensor a, Tensor b)
{
@@ -19,16 +19,5 @@ namespace Tensorflow

return new Tensor(_op, 0, _op.OutputType(0));
}

private static OpDefLibrary _InitOpDefLibrary()
{
// c_api.TF_GraphGetOpDef(g.Handle, op_type_name, buffer.Handle, status.Handle);
var bytes = File.ReadAllBytes("Operations/op_list_proto_math.bin");
var op_list = OpList.Parser.ParseFrom(bytes);
var op_def_lib = new OpDefLibrary();
op_def_lib.add_op_list(op_list);

return op_def_lib;
}
}
}

BIN
src/TensorFlowNET.Core/Operations/op_list_proto_array.bin View File


BIN
src/TensorFlowNET.Core/Operations/op_list_proto_math.bin View File


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

@@ -40,12 +40,6 @@ Docs: https://tensorflownet.readthedocs.io</Description>
</ItemGroup>

<ItemGroup>
<None Update="Operations\op_list_proto_array.bin">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Operations\op_list_proto_math.bin">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content CopyToOutputDirectory="PreserveNewest" Include="./runtimes/win-x64/native/tensorflow.dll" Link="tensorflow.dll" Pack="true" PackagePath="runtimes/win-x64/native/tensorflow.dll" />
</ItemGroup>



Loading…
Cancel
Save