remove op_list_proto_array and op_list_proto_mathtags/v0.1.0-Tensor
@@ -9,26 +9,10 @@ namespace Tensorflow | |||||
{ | { | ||||
public class OpDefLibrary | 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) | 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 g = ops.get_default_graph(); | ||||
var op_def = g.GetOpDef(op_type_name); | |||||
if (String.IsNullOrEmpty(name)) | if (String.IsNullOrEmpty(name)) | ||||
{ | { | ||||
@@ -8,7 +8,7 @@ namespace Tensorflow | |||||
{ | { | ||||
public static class gen_array_ops | 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) | public static Tensor placeholder(TF_DataType dtype, TensorShape shape = null) | ||||
{ | { | ||||
@@ -34,15 +34,5 @@ namespace Tensorflow | |||||
var tensor = new Tensor(_op, 0, dtype); | var tensor = new Tensor(_op, 0, dtype); | ||||
return tensor; | 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; | |||||
} | |||||
} | } | ||||
} | } |
@@ -7,7 +7,7 @@ namespace Tensorflow | |||||
{ | { | ||||
public static class gen_math_ops | 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) | public static Tensor add(Tensor a, Tensor b) | ||||
{ | { | ||||
@@ -19,16 +19,5 @@ namespace Tensorflow | |||||
return new Tensor(_op, 0, _op.OutputType(0)); | 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; | |||||
} | |||||
} | } | ||||
} | } |
@@ -40,12 +40,6 @@ Docs: https://tensorflownet.readthedocs.io</Description> | |||||
</ItemGroup> | </ItemGroup> | ||||
<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" /> | <Content CopyToOutputDirectory="PreserveNewest" Include="./runtimes/win-x64/native/tensorflow.dll" Link="tensorflow.dll" Pack="true" PackagePath="runtimes/win-x64/native/tensorflow.dll" /> | ||||
</ItemGroup> | </ItemGroup> | ||||