diff --git a/src/TensorFlowNET.Core/Operations/OpDefLibrary.cs b/src/TensorFlowNET.Core/Operations/OpDefLibrary.cs index 530469ea..aac58828 100644 --- a/src/TensorFlowNET.Core/Operations/OpDefLibrary.cs +++ b/src/TensorFlowNET.Core/Operations/OpDefLibrary.cs @@ -9,26 +9,10 @@ namespace Tensorflow { public class OpDefLibrary { - public Dictionary _ops = new Dictionary(); - - 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 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)) { diff --git a/src/TensorFlowNET.Core/Operations/gen_array_ops.cs b/src/TensorFlowNET.Core/Operations/gen_array_ops.cs index fbff32e0..8330fe28 100644 --- a/src/TensorFlowNET.Core/Operations/gen_array_ops.cs +++ b/src/TensorFlowNET.Core/Operations/gen_array_ops.cs @@ -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; - } } } diff --git a/src/TensorFlowNET.Core/Operations/gen_math_ops.cs b/src/TensorFlowNET.Core/Operations/gen_math_ops.cs index 8ebe36bf..e21b5b33 100644 --- a/src/TensorFlowNET.Core/Operations/gen_math_ops.cs +++ b/src/TensorFlowNET.Core/Operations/gen_math_ops.cs @@ -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; - } } } diff --git a/src/TensorFlowNET.Core/Operations/op_list_proto_array.bin b/src/TensorFlowNET.Core/Operations/op_list_proto_array.bin deleted file mode 100644 index 62d31e67..00000000 Binary files a/src/TensorFlowNET.Core/Operations/op_list_proto_array.bin and /dev/null differ diff --git a/src/TensorFlowNET.Core/Operations/op_list_proto_math.bin b/src/TensorFlowNET.Core/Operations/op_list_proto_math.bin deleted file mode 100644 index c94552c8..00000000 Binary files a/src/TensorFlowNET.Core/Operations/op_list_proto_math.bin and /dev/null differ diff --git a/src/TensorFlowNET.Core/TensorFlowNET.Core.csproj b/src/TensorFlowNET.Core/TensorFlowNET.Core.csproj index 379eea92..9d4e3b20 100644 --- a/src/TensorFlowNET.Core/TensorFlowNET.Core.csproj +++ b/src/TensorFlowNET.Core/TensorFlowNET.Core.csproj @@ -40,12 +40,6 @@ Docs: https://tensorflownet.readthedocs.io - - PreserveNewest - - - PreserveNewest -