diff --git a/examples/iris-example/data/README.md b/examples/iris-example/data/README.md new file mode 100644 index 0000000..e69de29 diff --git a/examples/iris-example/data/checkpoint b/examples/iris-example/data/checkpoint new file mode 100644 index 0000000..3df5a8f --- /dev/null +++ b/examples/iris-example/data/checkpoint @@ -0,0 +1,2 @@ +model_checkpoint_path: "/home/anshuman/coding_practice/Iris-Neural-Network/data/graph" +all_model_checkpoint_paths: "/home/anshuman/coding_practice/Iris-Neural-Network/data/graph" diff --git a/examples/iris-example/data/graph.data-00000-of-00001 b/examples/iris-example/data/graph.data-00000-of-00001 new file mode 100644 index 0000000..6ebd1cf --- /dev/null +++ b/examples/iris-example/data/graph.data-00000-of-00001 @@ -0,0 +1,2 @@ +ȽG"=̲ >uC?j>j=䙈CB'? H?xHL@<?v?Wd?x> +?~?1>AVPv?Ţu?F"y?"q?x6?ȍH1iH_ܱWZ?&?t=afJ]>I? ^?Ň?q뿏cـ?ӌ?Dߚ?moCap9?瘿9/? \ No newline at end of file diff --git a/examples/iris-example/data/graph.index b/examples/iris-example/data/graph.index new file mode 100644 index 0000000..3b2630e Binary files /dev/null and b/examples/iris-example/data/graph.index differ diff --git a/examples/iris-example/data/graph.meta b/examples/iris-example/data/graph.meta new file mode 100644 index 0000000..cecde59 Binary files /dev/null and b/examples/iris-example/data/graph.meta differ diff --git a/examples/iris-example/data/graph.pbtxt b/examples/iris-example/data/graph.pbtxt new file mode 100644 index 0000000..2092145 --- /dev/null +++ b/examples/iris-example/data/graph.pbtxt @@ -0,0 +1,3277 @@ +node { + name: "input" + op: "Placeholder" + attr { + key: "dtype" + value { + type: DT_FLOAT + } + } + attr { + key: "shape" + value { + shape { + } + } + } +} +node { + name: "Placeholder" + op: "Placeholder" + attr { + key: "dtype" + value { + type: DT_FLOAT + } + } + attr { + key: "shape" + value { + shape { + } + } + } +} +node { + name: "random_normal/shape" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + dim { + size: 2 + } + } + tensor_content: "\004\000\000\000\010\000\000\000" + } + } + } +} +node { + name: "random_normal/mean" + op: "Const" + attr { + key: "dtype" + value { + type: DT_FLOAT + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + } + float_val: 0.0 + } + } + } +} +node { + name: "random_normal/stddev" + op: "Const" + attr { + key: "dtype" + value { + type: DT_FLOAT + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + } + float_val: 1.0 + } + } + } +} +node { + name: "random_normal/RandomStandardNormal" + op: "RandomStandardNormal" + input: "random_normal/shape" + attr { + key: "T" + value { + type: DT_INT32 + } + } + attr { + key: "dtype" + value { + type: DT_FLOAT + } + } + attr { + key: "seed" + value { + i: 1234 + } + } + attr { + key: "seed2" + value { + i: 5 + } + } +} +node { + name: "random_normal/mul" + op: "Mul" + input: "random_normal/RandomStandardNormal" + input: "random_normal/stddev" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "random_normal" + op: "Add" + input: "random_normal/mul" + input: "random_normal/mean" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "weights1" + op: "Variable" + attr { + key: "container" + value { + s: "" + } + } + attr { + key: "dtype" + value { + type: DT_FLOAT + } + } + attr { + key: "shape" + value { + shape { + dim { + size: 4 + } + dim { + size: 8 + } + } + } + } + attr { + key: "shared_name" + value { + s: "" + } + } +} +node { + name: "weights1/Assign" + op: "Assign" + input: "weights1" + input: "random_normal" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@weights1" + } + } + } + attr { + key: "use_locking" + value { + b: true + } + } + attr { + key: "validate_shape" + value { + b: true + } + } +} +node { + name: "weights1/read" + op: "Identity" + input: "weights1" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@weights1" + } + } + } +} +node { + name: "random_normal_1/shape" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + dim { + size: 1 + } + } + int_val: 8 + } + } + } +} +node { + name: "random_normal_1/mean" + op: "Const" + attr { + key: "dtype" + value { + type: DT_FLOAT + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + } + float_val: 0.0 + } + } + } +} +node { + name: "random_normal_1/stddev" + op: "Const" + attr { + key: "dtype" + value { + type: DT_FLOAT + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + } + float_val: 1.0 + } + } + } +} +node { + name: "random_normal_1/RandomStandardNormal" + op: "RandomStandardNormal" + input: "random_normal_1/shape" + attr { + key: "T" + value { + type: DT_INT32 + } + } + attr { + key: "dtype" + value { + type: DT_FLOAT + } + } + attr { + key: "seed" + value { + i: 1234 + } + } + attr { + key: "seed2" + value { + i: 14 + } + } +} +node { + name: "random_normal_1/mul" + op: "Mul" + input: "random_normal_1/RandomStandardNormal" + input: "random_normal_1/stddev" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "random_normal_1" + op: "Add" + input: "random_normal_1/mul" + input: "random_normal_1/mean" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "biases1" + op: "Variable" + attr { + key: "container" + value { + s: "" + } + } + attr { + key: "dtype" + value { + type: DT_FLOAT + } + } + attr { + key: "shape" + value { + shape { + dim { + size: 8 + } + } + } + } + attr { + key: "shared_name" + value { + s: "" + } + } +} +node { + name: "biases1/Assign" + op: "Assign" + input: "biases1" + input: "random_normal_1" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@biases1" + } + } + } + attr { + key: "use_locking" + value { + b: true + } + } + attr { + key: "validate_shape" + value { + b: true + } + } +} +node { + name: "biases1/read" + op: "Identity" + input: "biases1" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@biases1" + } + } + } +} +node { + name: "random_normal_2/shape" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + dim { + size: 2 + } + } + tensor_content: "\010\000\000\000\003\000\000\000" + } + } + } +} +node { + name: "random_normal_2/mean" + op: "Const" + attr { + key: "dtype" + value { + type: DT_FLOAT + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + } + float_val: 0.0 + } + } + } +} +node { + name: "random_normal_2/stddev" + op: "Const" + attr { + key: "dtype" + value { + type: DT_FLOAT + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + } + float_val: 1.0 + } + } + } +} +node { + name: "random_normal_2/RandomStandardNormal" + op: "RandomStandardNormal" + input: "random_normal_2/shape" + attr { + key: "T" + value { + type: DT_INT32 + } + } + attr { + key: "dtype" + value { + type: DT_FLOAT + } + } + attr { + key: "seed" + value { + i: 1234 + } + } + attr { + key: "seed2" + value { + i: 23 + } + } +} +node { + name: "random_normal_2/mul" + op: "Mul" + input: "random_normal_2/RandomStandardNormal" + input: "random_normal_2/stddev" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "random_normal_2" + op: "Add" + input: "random_normal_2/mul" + input: "random_normal_2/mean" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "weights2" + op: "Variable" + attr { + key: "container" + value { + s: "" + } + } + attr { + key: "dtype" + value { + type: DT_FLOAT + } + } + attr { + key: "shape" + value { + shape { + dim { + size: 8 + } + dim { + size: 3 + } + } + } + } + attr { + key: "shared_name" + value { + s: "" + } + } +} +node { + name: "weights2/Assign" + op: "Assign" + input: "weights2" + input: "random_normal_2" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@weights2" + } + } + } + attr { + key: "use_locking" + value { + b: true + } + } + attr { + key: "validate_shape" + value { + b: true + } + } +} +node { + name: "weights2/read" + op: "Identity" + input: "weights2" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@weights2" + } + } + } +} +node { + name: "random_normal_3/shape" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + dim { + size: 1 + } + } + int_val: 3 + } + } + } +} +node { + name: "random_normal_3/mean" + op: "Const" + attr { + key: "dtype" + value { + type: DT_FLOAT + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + } + float_val: 0.0 + } + } + } +} +node { + name: "random_normal_3/stddev" + op: "Const" + attr { + key: "dtype" + value { + type: DT_FLOAT + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + } + float_val: 1.0 + } + } + } +} +node { + name: "random_normal_3/RandomStandardNormal" + op: "RandomStandardNormal" + input: "random_normal_3/shape" + attr { + key: "T" + value { + type: DT_INT32 + } + } + attr { + key: "dtype" + value { + type: DT_FLOAT + } + } + attr { + key: "seed" + value { + i: 1234 + } + } + attr { + key: "seed2" + value { + i: 32 + } + } +} +node { + name: "random_normal_3/mul" + op: "Mul" + input: "random_normal_3/RandomStandardNormal" + input: "random_normal_3/stddev" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "random_normal_3" + op: "Add" + input: "random_normal_3/mul" + input: "random_normal_3/mean" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "biases2" + op: "Variable" + attr { + key: "container" + value { + s: "" + } + } + attr { + key: "dtype" + value { + type: DT_FLOAT + } + } + attr { + key: "shape" + value { + shape { + dim { + size: 3 + } + } + } + } + attr { + key: "shared_name" + value { + s: "" + } + } +} +node { + name: "biases2/Assign" + op: "Assign" + input: "biases2" + input: "random_normal_3" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@biases2" + } + } + } + attr { + key: "use_locking" + value { + b: true + } + } + attr { + key: "validate_shape" + value { + b: true + } + } +} +node { + name: "biases2/read" + op: "Identity" + input: "biases2" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@biases2" + } + } + } +} +node { + name: "MatMul" + op: "MatMul" + input: "input" + input: "weights1/read" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "transpose_a" + value { + b: false + } + } + attr { + key: "transpose_b" + value { + b: false + } + } +} +node { + name: "Add" + op: "Add" + input: "MatMul" + input: "biases1/read" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "Relu" + op: "Relu" + input: "Add" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "MatMul_1" + op: "MatMul" + input: "Relu" + input: "weights2/read" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "transpose_a" + value { + b: false + } + } + attr { + key: "transpose_b" + value { + b: false + } + } +} +node { + name: "Add_1" + op: "Add" + input: "MatMul_1" + input: "biases2/read" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "output" + op: "Softmax" + input: "Add_1" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "Log" + op: "Log" + input: "output" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "mul" + op: "Mul" + input: "Placeholder" + input: "Log" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "Sum/reduction_indices" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + } + int_val: 0 + } + } + } +} +node { + name: "Sum" + op: "Sum" + input: "mul" + input: "Sum/reduction_indices" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "Tidx" + value { + type: DT_INT32 + } + } + attr { + key: "keep_dims" + value { + b: false + } + } +} +node { + name: "Neg" + op: "Neg" + input: "Sum" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "Const" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + dim { + size: 1 + } + } + int_val: 0 + } + } + } +} +node { + name: "Mean" + op: "Mean" + input: "Neg" + input: "Const" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "Tidx" + value { + type: DT_INT32 + } + } + attr { + key: "keep_dims" + value { + b: false + } + } +} +node { + name: "gradients/Shape" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + dim { + } + } + } + } + } +} +node { + name: "gradients/Const" + op: "Const" + attr { + key: "dtype" + value { + type: DT_FLOAT + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + } + float_val: 1.0 + } + } + } +} +node { + name: "gradients/Fill" + op: "Fill" + input: "gradients/Shape" + input: "gradients/Const" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "gradients/Mean_grad/Reshape/shape" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + dim { + size: 1 + } + } + int_val: 1 + } + } + } +} +node { + name: "gradients/Mean_grad/Reshape" + op: "Reshape" + input: "gradients/Fill" + input: "gradients/Mean_grad/Reshape/shape" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "Tshape" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Mean_grad/Tile/multiples" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + dim { + size: 1 + } + } + int_val: 3 + } + } + } +} +node { + name: "gradients/Mean_grad/Tile" + op: "Tile" + input: "gradients/Mean_grad/Reshape" + input: "gradients/Mean_grad/Tile/multiples" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "Tmultiples" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Mean_grad/Shape" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + dim { + size: 1 + } + } + int_val: 3 + } + } + } +} +node { + name: "gradients/Mean_grad/Shape_1" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + dim { + } + } + } + } + } +} +node { + name: "gradients/Mean_grad/Const" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + dim { + size: 1 + } + } + int_val: 0 + } + } + } +} +node { + name: "gradients/Mean_grad/Prod" + op: "Prod" + input: "gradients/Mean_grad/Shape" + input: "gradients/Mean_grad/Const" + attr { + key: "T" + value { + type: DT_INT32 + } + } + attr { + key: "Tidx" + value { + type: DT_INT32 + } + } + attr { + key: "keep_dims" + value { + b: false + } + } +} +node { + name: "gradients/Mean_grad/Const_1" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + dim { + size: 1 + } + } + int_val: 0 + } + } + } +} +node { + name: "gradients/Mean_grad/Prod_1" + op: "Prod" + input: "gradients/Mean_grad/Shape_1" + input: "gradients/Mean_grad/Const_1" + attr { + key: "T" + value { + type: DT_INT32 + } + } + attr { + key: "Tidx" + value { + type: DT_INT32 + } + } + attr { + key: "keep_dims" + value { + b: false + } + } +} +node { + name: "gradients/Mean_grad/Maximum/y" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + } + int_val: 1 + } + } + } +} +node { + name: "gradients/Mean_grad/Maximum" + op: "Maximum" + input: "gradients/Mean_grad/Prod_1" + input: "gradients/Mean_grad/Maximum/y" + attr { + key: "T" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Mean_grad/floordiv" + op: "Div" + input: "gradients/Mean_grad/Prod" + input: "gradients/Mean_grad/Maximum" + attr { + key: "T" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Mean_grad/Cast" + op: "Cast" + input: "gradients/Mean_grad/floordiv" + attr { + key: "DstT" + value { + type: DT_FLOAT + } + } + attr { + key: "SrcT" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Mean_grad/truediv" + op: "Div" + input: "gradients/Mean_grad/Tile" + input: "gradients/Mean_grad/Cast" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "gradients/Neg_grad/Neg" + op: "Neg" + input: "gradients/Mean_grad/truediv" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "gradients/Sum_grad/Shape" + op: "Shape" + input: "mul" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "out_type" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Sum_grad/Size" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + } + int_val: 2 + } + } + } +} +node { + name: "gradients/Sum_grad/add" + op: "Add" + input: "Sum/reduction_indices" + input: "gradients/Sum_grad/Size" + attr { + key: "T" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Sum_grad/mod" + op: "Mod" + input: "gradients/Sum_grad/add" + input: "gradients/Sum_grad/Size" + attr { + key: "T" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Sum_grad/Shape_1" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + dim { + } + } + } + } + } +} +node { + name: "gradients/Sum_grad/range/start" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + } + int_val: 0 + } + } + } +} +node { + name: "gradients/Sum_grad/range/delta" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + } + int_val: 1 + } + } + } +} +node { + name: "gradients/Sum_grad/range" + op: "Range" + input: "gradients/Sum_grad/range/start" + input: "gradients/Sum_grad/Size" + input: "gradients/Sum_grad/range/delta" + attr { + key: "Tidx" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Sum_grad/Fill/value" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + } + int_val: 1 + } + } + } +} +node { + name: "gradients/Sum_grad/Fill" + op: "Fill" + input: "gradients/Sum_grad/Shape_1" + input: "gradients/Sum_grad/Fill/value" + attr { + key: "T" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Sum_grad/DynamicStitch" + op: "DynamicStitch" + input: "gradients/Sum_grad/range" + input: "gradients/Sum_grad/mod" + input: "gradients/Sum_grad/Shape" + input: "gradients/Sum_grad/Fill" + attr { + key: "N" + value { + i: 2 + } + } + attr { + key: "T" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Sum_grad/Maximum/y" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + } + int_val: 1 + } + } + } +} +node { + name: "gradients/Sum_grad/Maximum" + op: "Maximum" + input: "gradients/Sum_grad/DynamicStitch" + input: "gradients/Sum_grad/Maximum/y" + attr { + key: "T" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Sum_grad/floordiv" + op: "Div" + input: "gradients/Sum_grad/Shape" + input: "gradients/Sum_grad/Maximum" + attr { + key: "T" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Sum_grad/Reshape" + op: "Reshape" + input: "gradients/Neg_grad/Neg" + input: "gradients/Sum_grad/DynamicStitch" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "Tshape" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Sum_grad/Tile" + op: "Tile" + input: "gradients/Sum_grad/Reshape" + input: "gradients/Sum_grad/floordiv" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "Tmultiples" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/mul_grad/Shape" + op: "Shape" + input: "Placeholder" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "out_type" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/mul_grad/Shape_1" + op: "Shape" + input: "Log" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "out_type" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/mul_grad/BroadcastGradientArgs" + op: "BroadcastGradientArgs" + input: "gradients/mul_grad/Shape" + input: "gradients/mul_grad/Shape_1" + attr { + key: "T" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/mul_grad/mul" + op: "Mul" + input: "gradients/Sum_grad/Tile" + input: "Log" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "gradients/mul_grad/Sum" + op: "Sum" + input: "gradients/mul_grad/mul" + input: "gradients/mul_grad/BroadcastGradientArgs" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "Tidx" + value { + type: DT_INT32 + } + } + attr { + key: "keep_dims" + value { + b: false + } + } +} +node { + name: "gradients/mul_grad/Reshape" + op: "Reshape" + input: "gradients/mul_grad/Sum" + input: "gradients/mul_grad/Shape" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "Tshape" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/mul_grad/mul_1" + op: "Mul" + input: "Placeholder" + input: "gradients/Sum_grad/Tile" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "gradients/mul_grad/Sum_1" + op: "Sum" + input: "gradients/mul_grad/mul_1" + input: "gradients/mul_grad/BroadcastGradientArgs:1" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "Tidx" + value { + type: DT_INT32 + } + } + attr { + key: "keep_dims" + value { + b: false + } + } +} +node { + name: "gradients/mul_grad/Reshape_1" + op: "Reshape" + input: "gradients/mul_grad/Sum_1" + input: "gradients/mul_grad/Shape_1" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "Tshape" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/mul_grad/tuple/group_deps" + op: "NoOp" + input: "^gradients/mul_grad/Reshape" + input: "^gradients/mul_grad/Reshape_1" +} +node { + name: "gradients/mul_grad/tuple/control_dependency" + op: "Identity" + input: "gradients/mul_grad/Reshape" + input: "^gradients/mul_grad/tuple/group_deps" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@gradients/mul_grad/Reshape" + } + } + } +} +node { + name: "gradients/mul_grad/tuple/control_dependency_1" + op: "Identity" + input: "gradients/mul_grad/Reshape_1" + input: "^gradients/mul_grad/tuple/group_deps" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@gradients/mul_grad/Reshape_1" + } + } + } +} +node { + name: "gradients/Log_grad/Reciprocal" + op: "Reciprocal" + input: "output" + input: "^gradients/mul_grad/tuple/control_dependency_1" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "gradients/Log_grad/mul" + op: "Mul" + input: "gradients/mul_grad/tuple/control_dependency_1" + input: "gradients/Log_grad/Reciprocal" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "gradients/output_grad/mul" + op: "Mul" + input: "gradients/Log_grad/mul" + input: "output" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "gradients/output_grad/Sum/reduction_indices" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + dim { + size: 1 + } + } + int_val: 1 + } + } + } +} +node { + name: "gradients/output_grad/Sum" + op: "Sum" + input: "gradients/output_grad/mul" + input: "gradients/output_grad/Sum/reduction_indices" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "Tidx" + value { + type: DT_INT32 + } + } + attr { + key: "keep_dims" + value { + b: false + } + } +} +node { + name: "gradients/output_grad/Reshape/shape" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + dim { + size: 2 + } + } + tensor_content: "\377\377\377\377\001\000\000\000" + } + } + } +} +node { + name: "gradients/output_grad/Reshape" + op: "Reshape" + input: "gradients/output_grad/Sum" + input: "gradients/output_grad/Reshape/shape" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "Tshape" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/output_grad/sub" + op: "Sub" + input: "gradients/Log_grad/mul" + input: "gradients/output_grad/Reshape" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "gradients/output_grad/mul_1" + op: "Mul" + input: "gradients/output_grad/sub" + input: "output" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "gradients/Add_1_grad/Shape" + op: "Shape" + input: "MatMul_1" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "out_type" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Add_1_grad/Shape_1" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + dim { + size: 1 + } + } + int_val: 3 + } + } + } +} +node { + name: "gradients/Add_1_grad/BroadcastGradientArgs" + op: "BroadcastGradientArgs" + input: "gradients/Add_1_grad/Shape" + input: "gradients/Add_1_grad/Shape_1" + attr { + key: "T" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Add_1_grad/Sum" + op: "Sum" + input: "gradients/output_grad/mul_1" + input: "gradients/Add_1_grad/BroadcastGradientArgs" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "Tidx" + value { + type: DT_INT32 + } + } + attr { + key: "keep_dims" + value { + b: false + } + } +} +node { + name: "gradients/Add_1_grad/Reshape" + op: "Reshape" + input: "gradients/Add_1_grad/Sum" + input: "gradients/Add_1_grad/Shape" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "Tshape" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Add_1_grad/Sum_1" + op: "Sum" + input: "gradients/output_grad/mul_1" + input: "gradients/Add_1_grad/BroadcastGradientArgs:1" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "Tidx" + value { + type: DT_INT32 + } + } + attr { + key: "keep_dims" + value { + b: false + } + } +} +node { + name: "gradients/Add_1_grad/Reshape_1" + op: "Reshape" + input: "gradients/Add_1_grad/Sum_1" + input: "gradients/Add_1_grad/Shape_1" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "Tshape" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Add_1_grad/tuple/group_deps" + op: "NoOp" + input: "^gradients/Add_1_grad/Reshape" + input: "^gradients/Add_1_grad/Reshape_1" +} +node { + name: "gradients/Add_1_grad/tuple/control_dependency" + op: "Identity" + input: "gradients/Add_1_grad/Reshape" + input: "^gradients/Add_1_grad/tuple/group_deps" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@gradients/Add_1_grad/Reshape" + } + } + } +} +node { + name: "gradients/Add_1_grad/tuple/control_dependency_1" + op: "Identity" + input: "gradients/Add_1_grad/Reshape_1" + input: "^gradients/Add_1_grad/tuple/group_deps" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@gradients/Add_1_grad/Reshape_1" + } + } + } +} +node { + name: "gradients/MatMul_1_grad/MatMul" + op: "MatMul" + input: "gradients/Add_1_grad/tuple/control_dependency" + input: "weights2/read" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "transpose_a" + value { + b: false + } + } + attr { + key: "transpose_b" + value { + b: true + } + } +} +node { + name: "gradients/MatMul_1_grad/MatMul_1" + op: "MatMul" + input: "Relu" + input: "gradients/Add_1_grad/tuple/control_dependency" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "transpose_a" + value { + b: true + } + } + attr { + key: "transpose_b" + value { + b: false + } + } +} +node { + name: "gradients/MatMul_1_grad/tuple/group_deps" + op: "NoOp" + input: "^gradients/MatMul_1_grad/MatMul" + input: "^gradients/MatMul_1_grad/MatMul_1" +} +node { + name: "gradients/MatMul_1_grad/tuple/control_dependency" + op: "Identity" + input: "gradients/MatMul_1_grad/MatMul" + input: "^gradients/MatMul_1_grad/tuple/group_deps" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@gradients/MatMul_1_grad/MatMul" + } + } + } +} +node { + name: "gradients/MatMul_1_grad/tuple/control_dependency_1" + op: "Identity" + input: "gradients/MatMul_1_grad/MatMul_1" + input: "^gradients/MatMul_1_grad/tuple/group_deps" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@gradients/MatMul_1_grad/MatMul_1" + } + } + } +} +node { + name: "gradients/Relu_grad/ReluGrad" + op: "ReluGrad" + input: "gradients/MatMul_1_grad/tuple/control_dependency" + input: "Relu" + attr { + key: "T" + value { + type: DT_FLOAT + } + } +} +node { + name: "gradients/Add_grad/Shape" + op: "Shape" + input: "MatMul" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "out_type" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Add_grad/Shape_1" + op: "Const" + attr { + key: "dtype" + value { + type: DT_INT32 + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + dim { + size: 1 + } + } + int_val: 8 + } + } + } +} +node { + name: "gradients/Add_grad/BroadcastGradientArgs" + op: "BroadcastGradientArgs" + input: "gradients/Add_grad/Shape" + input: "gradients/Add_grad/Shape_1" + attr { + key: "T" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Add_grad/Sum" + op: "Sum" + input: "gradients/Relu_grad/ReluGrad" + input: "gradients/Add_grad/BroadcastGradientArgs" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "Tidx" + value { + type: DT_INT32 + } + } + attr { + key: "keep_dims" + value { + b: false + } + } +} +node { + name: "gradients/Add_grad/Reshape" + op: "Reshape" + input: "gradients/Add_grad/Sum" + input: "gradients/Add_grad/Shape" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "Tshape" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Add_grad/Sum_1" + op: "Sum" + input: "gradients/Relu_grad/ReluGrad" + input: "gradients/Add_grad/BroadcastGradientArgs:1" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "Tidx" + value { + type: DT_INT32 + } + } + attr { + key: "keep_dims" + value { + b: false + } + } +} +node { + name: "gradients/Add_grad/Reshape_1" + op: "Reshape" + input: "gradients/Add_grad/Sum_1" + input: "gradients/Add_grad/Shape_1" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "Tshape" + value { + type: DT_INT32 + } + } +} +node { + name: "gradients/Add_grad/tuple/group_deps" + op: "NoOp" + input: "^gradients/Add_grad/Reshape" + input: "^gradients/Add_grad/Reshape_1" +} +node { + name: "gradients/Add_grad/tuple/control_dependency" + op: "Identity" + input: "gradients/Add_grad/Reshape" + input: "^gradients/Add_grad/tuple/group_deps" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@gradients/Add_grad/Reshape" + } + } + } +} +node { + name: "gradients/Add_grad/tuple/control_dependency_1" + op: "Identity" + input: "gradients/Add_grad/Reshape_1" + input: "^gradients/Add_grad/tuple/group_deps" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@gradients/Add_grad/Reshape_1" + } + } + } +} +node { + name: "gradients/MatMul_grad/MatMul" + op: "MatMul" + input: "gradients/Add_grad/tuple/control_dependency" + input: "weights1/read" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "transpose_a" + value { + b: false + } + } + attr { + key: "transpose_b" + value { + b: true + } + } +} +node { + name: "gradients/MatMul_grad/MatMul_1" + op: "MatMul" + input: "input" + input: "gradients/Add_grad/tuple/control_dependency" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "transpose_a" + value { + b: true + } + } + attr { + key: "transpose_b" + value { + b: false + } + } +} +node { + name: "gradients/MatMul_grad/tuple/group_deps" + op: "NoOp" + input: "^gradients/MatMul_grad/MatMul" + input: "^gradients/MatMul_grad/MatMul_1" +} +node { + name: "gradients/MatMul_grad/tuple/control_dependency" + op: "Identity" + input: "gradients/MatMul_grad/MatMul" + input: "^gradients/MatMul_grad/tuple/group_deps" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@gradients/MatMul_grad/MatMul" + } + } + } +} +node { + name: "gradients/MatMul_grad/tuple/control_dependency_1" + op: "Identity" + input: "gradients/MatMul_grad/MatMul_1" + input: "^gradients/MatMul_grad/tuple/group_deps" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@gradients/MatMul_grad/MatMul_1" + } + } + } +} +node { + name: "GradientDescent/learning_rate" + op: "Const" + attr { + key: "dtype" + value { + type: DT_FLOAT + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + } + float_val: 0.0010000000475 + } + } + } +} +node { + name: "GradientDescent/update_weights1/ApplyGradientDescent" + op: "ApplyGradientDescent" + input: "weights1" + input: "GradientDescent/learning_rate" + input: "gradients/MatMul_grad/tuple/control_dependency_1" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@weights1" + } + } + } + attr { + key: "use_locking" + value { + b: false + } + } +} +node { + name: "GradientDescent/update_biases1/ApplyGradientDescent" + op: "ApplyGradientDescent" + input: "biases1" + input: "GradientDescent/learning_rate" + input: "gradients/Add_grad/tuple/control_dependency_1" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@biases1" + } + } + } + attr { + key: "use_locking" + value { + b: false + } + } +} +node { + name: "GradientDescent/update_weights2/ApplyGradientDescent" + op: "ApplyGradientDescent" + input: "weights2" + input: "GradientDescent/learning_rate" + input: "gradients/MatMul_1_grad/tuple/control_dependency_1" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@weights2" + } + } + } + attr { + key: "use_locking" + value { + b: false + } + } +} +node { + name: "GradientDescent/update_biases2/ApplyGradientDescent" + op: "ApplyGradientDescent" + input: "biases2" + input: "GradientDescent/learning_rate" + input: "gradients/Add_1_grad/tuple/control_dependency_1" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@biases2" + } + } + } + attr { + key: "use_locking" + value { + b: false + } + } +} +node { + name: "GradientDescent" + op: "NoOp" + input: "^GradientDescent/update_weights1/ApplyGradientDescent" + input: "^GradientDescent/update_biases1/ApplyGradientDescent" + input: "^GradientDescent/update_weights2/ApplyGradientDescent" + input: "^GradientDescent/update_biases2/ApplyGradientDescent" +} +node { + name: "init" + op: "NoOp" + input: "^weights1/Assign" + input: "^biases1/Assign" + input: "^weights2/Assign" + input: "^biases2/Assign" +} +node { + name: "save/Const" + op: "Const" + attr { + key: "dtype" + value { + type: DT_STRING + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_STRING + tensor_shape { + } + string_val: "model" + } + } + } +} +node { + name: "save/SaveV2/tensor_names" + op: "Const" + attr { + key: "dtype" + value { + type: DT_STRING + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_STRING + tensor_shape { + dim { + size: 4 + } + } + string_val: "biases1" + string_val: "biases2" + string_val: "weights1" + string_val: "weights2" + } + } + } +} +node { + name: "save/SaveV2/shape_and_slices" + op: "Const" + attr { + key: "dtype" + value { + type: DT_STRING + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_STRING + tensor_shape { + dim { + size: 4 + } + } + string_val: "" + string_val: "" + string_val: "" + string_val: "" + } + } + } +} +node { + name: "save/SaveV2" + op: "SaveV2" + input: "save/Const" + input: "save/SaveV2/tensor_names" + input: "save/SaveV2/shape_and_slices" + input: "biases1" + input: "biases2" + input: "weights1" + input: "weights2" + attr { + key: "dtypes" + value { + list { + type: DT_FLOAT + type: DT_FLOAT + type: DT_FLOAT + type: DT_FLOAT + } + } + } +} +node { + name: "save/control_dependency" + op: "Identity" + input: "save/Const" + input: "^save/SaveV2" + attr { + key: "T" + value { + type: DT_STRING + } + } + attr { + key: "_class" + value { + list { + s: "loc:@save/Const" + } + } + } +} +node { + name: "save/RestoreV2/tensor_names" + op: "Const" + attr { + key: "dtype" + value { + type: DT_STRING + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_STRING + tensor_shape { + dim { + size: 1 + } + } + string_val: "biases1" + } + } + } +} +node { + name: "save/RestoreV2/shape_and_slices" + op: "Const" + attr { + key: "dtype" + value { + type: DT_STRING + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_STRING + tensor_shape { + dim { + size: 1 + } + } + string_val: "" + } + } + } +} +node { + name: "save/RestoreV2" + op: "RestoreV2" + input: "save/Const" + input: "save/RestoreV2/tensor_names" + input: "save/RestoreV2/shape_and_slices" + attr { + key: "dtypes" + value { + list { + type: DT_FLOAT + } + } + } +} +node { + name: "save/Assign" + op: "Assign" + input: "biases1" + input: "save/RestoreV2" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@biases1" + } + } + } + attr { + key: "use_locking" + value { + b: true + } + } + attr { + key: "validate_shape" + value { + b: true + } + } +} +node { + name: "save/RestoreV2_1/tensor_names" + op: "Const" + attr { + key: "dtype" + value { + type: DT_STRING + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_STRING + tensor_shape { + dim { + size: 1 + } + } + string_val: "biases2" + } + } + } +} +node { + name: "save/RestoreV2_1/shape_and_slices" + op: "Const" + attr { + key: "dtype" + value { + type: DT_STRING + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_STRING + tensor_shape { + dim { + size: 1 + } + } + string_val: "" + } + } + } +} +node { + name: "save/RestoreV2_1" + op: "RestoreV2" + input: "save/Const" + input: "save/RestoreV2_1/tensor_names" + input: "save/RestoreV2_1/shape_and_slices" + attr { + key: "dtypes" + value { + list { + type: DT_FLOAT + } + } + } +} +node { + name: "save/Assign_1" + op: "Assign" + input: "biases2" + input: "save/RestoreV2_1" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@biases2" + } + } + } + attr { + key: "use_locking" + value { + b: true + } + } + attr { + key: "validate_shape" + value { + b: true + } + } +} +node { + name: "save/RestoreV2_2/tensor_names" + op: "Const" + attr { + key: "dtype" + value { + type: DT_STRING + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_STRING + tensor_shape { + dim { + size: 1 + } + } + string_val: "weights1" + } + } + } +} +node { + name: "save/RestoreV2_2/shape_and_slices" + op: "Const" + attr { + key: "dtype" + value { + type: DT_STRING + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_STRING + tensor_shape { + dim { + size: 1 + } + } + string_val: "" + } + } + } +} +node { + name: "save/RestoreV2_2" + op: "RestoreV2" + input: "save/Const" + input: "save/RestoreV2_2/tensor_names" + input: "save/RestoreV2_2/shape_and_slices" + attr { + key: "dtypes" + value { + list { + type: DT_FLOAT + } + } + } +} +node { + name: "save/Assign_2" + op: "Assign" + input: "weights1" + input: "save/RestoreV2_2" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@weights1" + } + } + } + attr { + key: "use_locking" + value { + b: true + } + } + attr { + key: "validate_shape" + value { + b: true + } + } +} +node { + name: "save/RestoreV2_3/tensor_names" + op: "Const" + attr { + key: "dtype" + value { + type: DT_STRING + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_STRING + tensor_shape { + dim { + size: 1 + } + } + string_val: "weights2" + } + } + } +} +node { + name: "save/RestoreV2_3/shape_and_slices" + op: "Const" + attr { + key: "dtype" + value { + type: DT_STRING + } + } + attr { + key: "value" + value { + tensor { + dtype: DT_STRING + tensor_shape { + dim { + size: 1 + } + } + string_val: "" + } + } + } +} +node { + name: "save/RestoreV2_3" + op: "RestoreV2" + input: "save/Const" + input: "save/RestoreV2_3/tensor_names" + input: "save/RestoreV2_3/shape_and_slices" + attr { + key: "dtypes" + value { + list { + type: DT_FLOAT + } + } + } +} +node { + name: "save/Assign_3" + op: "Assign" + input: "weights2" + input: "save/RestoreV2_3" + attr { + key: "T" + value { + type: DT_FLOAT + } + } + attr { + key: "_class" + value { + list { + s: "loc:@weights2" + } + } + } + attr { + key: "use_locking" + value { + b: true + } + } + attr { + key: "validate_shape" + value { + b: true + } + } +} +node { + name: "save/restore_all" + op: "NoOp" + input: "^save/Assign" + input: "^save/Assign_1" + input: "^save/Assign_2" + input: "^save/Assign_3" +} +versions { + producer: 17 +} diff --git a/examples/iris-example/data/graphdef.pb b/examples/iris-example/data/graphdef.pb new file mode 100644 index 0000000..d02925e Binary files /dev/null and b/examples/iris-example/data/graphdef.pb differ diff --git a/examples/iris-example/dataset.csv b/examples/iris-example/dataset.csv new file mode 100644 index 0000000..1bf42f2 --- /dev/null +++ b/examples/iris-example/dataset.csv @@ -0,0 +1,151 @@ +Id,SepalLengthCm,SepalWidthCm,PetalLengthCm,PetalWidthCm,Species +1,5.1,3.5,1.4,0.2,Iris-setosa +2,4.9,3.0,1.4,0.2,Iris-setosa +3,4.7,3.2,1.3,0.2,Iris-setosa +4,4.6,3.1,1.5,0.2,Iris-setosa +5,5.0,3.6,1.4,0.2,Iris-setosa +6,5.4,3.9,1.7,0.4,Iris-setosa +7,4.6,3.4,1.4,0.3,Iris-setosa +8,5.0,3.4,1.5,0.2,Iris-setosa +9,4.4,2.9,1.4,0.2,Iris-setosa +10,4.9,3.1,1.5,0.1,Iris-setosa +11,5.4,3.7,1.5,0.2,Iris-setosa +12,4.8,3.4,1.6,0.2,Iris-setosa +13,4.8,3.0,1.4,0.1,Iris-setosa +14,4.3,3.0,1.1,0.1,Iris-setosa +15,5.8,4.0,1.2,0.2,Iris-setosa +16,5.7,4.4,1.5,0.4,Iris-setosa +17,5.4,3.9,1.3,0.4,Iris-setosa +18,5.1,3.5,1.4,0.3,Iris-setosa +19,5.7,3.8,1.7,0.3,Iris-setosa +20,5.1,3.8,1.5,0.3,Iris-setosa +21,5.4,3.4,1.7,0.2,Iris-setosa +22,5.1,3.7,1.5,0.4,Iris-setosa +23,4.6,3.6,1.0,0.2,Iris-setosa +24,5.1,3.3,1.7,0.5,Iris-setosa +25,4.8,3.4,1.9,0.2,Iris-setosa +26,5.0,3.0,1.6,0.2,Iris-setosa +27,5.0,3.4,1.6,0.4,Iris-setosa +28,5.2,3.5,1.5,0.2,Iris-setosa +29,5.2,3.4,1.4,0.2,Iris-setosa +30,4.7,3.2,1.6,0.2,Iris-setosa +31,4.8,3.1,1.6,0.2,Iris-setosa +32,5.4,3.4,1.5,0.4,Iris-setosa +33,5.2,4.1,1.5,0.1,Iris-setosa +34,5.5,4.2,1.4,0.2,Iris-setosa +35,4.9,3.1,1.5,0.1,Iris-setosa +36,5.0,3.2,1.2,0.2,Iris-setosa +37,5.5,3.5,1.3,0.2,Iris-setosa +38,4.9,3.1,1.5,0.1,Iris-setosa +39,4.4,3.0,1.3,0.2,Iris-setosa +40,5.1,3.4,1.5,0.2,Iris-setosa +41,5.0,3.5,1.3,0.3,Iris-setosa +42,4.5,2.3,1.3,0.3,Iris-setosa +43,4.4,3.2,1.3,0.2,Iris-setosa +44,5.0,3.5,1.6,0.6,Iris-setosa +45,5.1,3.8,1.9,0.4,Iris-setosa +46,4.8,3.0,1.4,0.3,Iris-setosa +47,5.1,3.8,1.6,0.2,Iris-setosa +48,4.6,3.2,1.4,0.2,Iris-setosa +49,5.3,3.7,1.5,0.2,Iris-setosa +50,5.0,3.3,1.4,0.2,Iris-setosa +51,7.0,3.2,4.7,1.4,Iris-versicolor +52,6.4,3.2,4.5,1.5,Iris-versicolor +53,6.9,3.1,4.9,1.5,Iris-versicolor +54,5.5,2.3,4.0,1.3,Iris-versicolor +55,6.5,2.8,4.6,1.5,Iris-versicolor +56,5.7,2.8,4.5,1.3,Iris-versicolor +57,6.3,3.3,4.7,1.6,Iris-versicolor +58,4.9,2.4,3.3,1.0,Iris-versicolor +59,6.6,2.9,4.6,1.3,Iris-versicolor +60,5.2,2.7,3.9,1.4,Iris-versicolor +61,5.0,2.0,3.5,1.0,Iris-versicolor +62,5.9,3.0,4.2,1.5,Iris-versicolor +63,6.0,2.2,4.0,1.0,Iris-versicolor +64,6.1,2.9,4.7,1.4,Iris-versicolor +65,5.6,2.9,3.6,1.3,Iris-versicolor +66,6.7,3.1,4.4,1.4,Iris-versicolor +67,5.6,3.0,4.5,1.5,Iris-versicolor +68,5.8,2.7,4.1,1.0,Iris-versicolor +69,6.2,2.2,4.5,1.5,Iris-versicolor +70,5.6,2.5,3.9,1.1,Iris-versicolor +71,5.9,3.2,4.8,1.8,Iris-versicolor +72,6.1,2.8,4.0,1.3,Iris-versicolor +73,6.3,2.5,4.9,1.5,Iris-versicolor +74,6.1,2.8,4.7,1.2,Iris-versicolor +75,6.4,2.9,4.3,1.3,Iris-versicolor +76,6.6,3.0,4.4,1.4,Iris-versicolor +77,6.8,2.8,4.8,1.4,Iris-versicolor +78,6.7,3.0,5.0,1.7,Iris-versicolor +79,6.0,2.9,4.5,1.5,Iris-versicolor +80,5.7,2.6,3.5,1.0,Iris-versicolor +81,5.5,2.4,3.8,1.1,Iris-versicolor +82,5.5,2.4,3.7,1.0,Iris-versicolor +83,5.8,2.7,3.9,1.2,Iris-versicolor +84,6.0,2.7,5.1,1.6,Iris-versicolor +85,5.4,3.0,4.5,1.5,Iris-versicolor +86,6.0,3.4,4.5,1.6,Iris-versicolor +87,6.7,3.1,4.7,1.5,Iris-versicolor +88,6.3,2.3,4.4,1.3,Iris-versicolor +89,5.6,3.0,4.1,1.3,Iris-versicolor +90,5.5,2.5,4.0,1.3,Iris-versicolor +91,5.5,2.6,4.4,1.2,Iris-versicolor +92,6.1,3.0,4.6,1.4,Iris-versicolor +93,5.8,2.6,4.0,1.2,Iris-versicolor +94,5.0,2.3,3.3,1.0,Iris-versicolor +95,5.6,2.7,4.2,1.3,Iris-versicolor +96,5.7,3.0,4.2,1.2,Iris-versicolor +97,5.7,2.9,4.2,1.3,Iris-versicolor +98,6.2,2.9,4.3,1.3,Iris-versicolor +99,5.1,2.5,3.0,1.1,Iris-versicolor +100,5.7,2.8,4.1,1.3,Iris-versicolor +101,6.3,3.3,6.0,2.5,Iris-virginica +102,5.8,2.7,5.1,1.9,Iris-virginica +103,7.1,3.0,5.9,2.1,Iris-virginica +104,6.3,2.9,5.6,1.8,Iris-virginica +105,6.5,3.0,5.8,2.2,Iris-virginica +106,7.6,3.0,6.6,2.1,Iris-virginica +107,4.9,2.5,4.5,1.7,Iris-virginica +108,7.3,2.9,6.3,1.8,Iris-virginica +109,6.7,2.5,5.8,1.8,Iris-virginica +110,7.2,3.6,6.1,2.5,Iris-virginica +111,6.5,3.2,5.1,2.0,Iris-virginica +112,6.4,2.7,5.3,1.9,Iris-virginica +113,6.8,3.0,5.5,2.1,Iris-virginica +114,5.7,2.5,5.0,2.0,Iris-virginica +115,5.8,2.8,5.1,2.4,Iris-virginica +116,6.4,3.2,5.3,2.3,Iris-virginica +117,6.5,3.0,5.5,1.8,Iris-virginica +118,7.7,3.8,6.7,2.2,Iris-virginica +119,7.7,2.6,6.9,2.3,Iris-virginica +120,6.0,2.2,5.0,1.5,Iris-virginica +121,6.9,3.2,5.7,2.3,Iris-virginica +122,5.6,2.8,4.9,2.0,Iris-virginica +123,7.7,2.8,6.7,2.0,Iris-virginica +124,6.3,2.7,4.9,1.8,Iris-virginica +125,6.7,3.3,5.7,2.1,Iris-virginica +126,7.2,3.2,6.0,1.8,Iris-virginica +127,6.2,2.8,4.8,1.8,Iris-virginica +128,6.1,3.0,4.9,1.8,Iris-virginica +129,6.4,2.8,5.6,2.1,Iris-virginica +130,7.2,3.0,5.8,1.6,Iris-virginica +131,7.4,2.8,6.1,1.9,Iris-virginica +132,7.9,3.8,6.4,2.0,Iris-virginica +133,6.4,2.8,5.6,2.2,Iris-virginica +134,6.3,2.8,5.1,1.5,Iris-virginica +135,6.1,2.6,5.6,1.4,Iris-virginica +136,7.7,3.0,6.1,2.3,Iris-virginica +137,6.3,3.4,5.6,2.4,Iris-virginica +138,6.4,3.1,5.5,1.8,Iris-virginica +139,6.0,3.0,4.8,1.8,Iris-virginica +140,6.9,3.1,5.4,2.1,Iris-virginica +141,6.7,3.1,5.6,2.4,Iris-virginica +142,6.9,3.1,5.1,2.3,Iris-virginica +143,5.8,2.7,5.1,1.9,Iris-virginica +144,6.8,3.2,5.9,2.3,Iris-virginica +145,6.7,3.3,5.7,2.5,Iris-virginica +146,6.7,3.0,5.2,2.3,Iris-virginica +147,6.3,2.5,5.0,1.9,Iris-virginica +148,6.5,3.0,5.2,2.0,Iris-virginica +149,6.2,3.4,5.4,2.3,Iris-virginica +150,5.9,3.0,5.1,1.8,Iris-virginica diff --git a/examples/iris-example/train_model.py b/examples/iris-example/train_model.py new file mode 100644 index 0000000..de34ff5 --- /dev/null +++ b/examples/iris-example/train_model.py @@ -0,0 +1,75 @@ +import tensorflow as tf +import pandas as pd +import numpy as np +from tensorflow.python.tools import freeze_graph +import os + +dir = os.path.dirname(os.path.realpath(__file__)) + '/data/' + +seed = 1234 +np.random.seed(seed) +tf.set_random_seed(seed) + +dataset = pd.read_csv('dataset.csv') +dataset = pd.get_dummies(dataset, columns=['Species']) +values = list(dataset.columns.values) + +y = dataset[values[-3:]] +y = np.array(y, dtype='float32') +X = dataset[values[1:-3]] +X = np.array(X, dtype='float32') + +indices = np.random.choice(len(X), len(X), replace=False) +X_values = X[indices] +y_values = y[indices] + +test_size = 10 +X_test = X_values[-test_size:] +X_train = X_values[:-test_size] +y_test = y_values[-test_size:] +y_train = y_values[:-test_size] + +sess = tf.Session() + +interval = 50 +epoch = 500 + +X_data = tf.placeholder(shape=[None, 4], dtype=tf.float32, name='input') +y_target = tf.placeholder(shape=[None, 3], dtype=tf.float32) + +hidden_layer_nodes = 8 + +w1 = tf.Variable(tf.random_normal(shape=[4,hidden_layer_nodes]), name='weights1') +b1 = tf.Variable(tf.random_normal(shape=[hidden_layer_nodes]), name='biases1') +w2 = tf.Variable(tf.random_normal(shape=[hidden_layer_nodes,3]), name='weights2') +b2 = tf.Variable(tf.random_normal(shape=[3]),name='biases2') + + +hidden_output = tf.nn.relu(tf.add(tf.matmul(X_data, w1), b1)) +final_output = tf.nn.softmax(tf.add(tf.matmul(hidden_output, w2), b2), name='output') + + +loss = tf.reduce_mean(-tf.reduce_sum(y_target * tf.log(final_output), axis=0)) + + +optimizer = tf.train.GradientDescentOptimizer(learning_rate=0.001).minimize(loss) + + +init = tf.global_variables_initializer() +sess.run(init) + +saver = tf.train.Saver() + +print('Training the model...') +for i in range(1, (epoch + 1)): + sess.run(optimizer, feed_dict={X_data: X_train, y_target: y_train}) + if i % interval == 0: + print('Epoch', i, '|', 'Loss:', sess.run(loss, feed_dict={X_data: X_train, y_target: y_train})) + +tf.train.write_graph(sess.graph_def, dir, 'graph.pbtxt') +saver.save(sess, dir+'graph') +freeze_graph.freeze_graph(dir+'graph.pbtxt','', False, dir+'graph', 'output', 'save/restore_all', 'save/Const:0', 'data/graphdef.pb', True, '') + +for i in range(len(X_test)): + print('For datapoint: '+ str(X_test[i])+ ' Actual:', y_test[i], 'Predicted:', np.rint(sess.run(final_output, feed_dict={X_data: [X_test[i]]}))) + diff --git a/examples/graphdef_create.py b/examples/toy-example/graphdef_create.py similarity index 100% rename from examples/graphdef_create.py rename to examples/toy-example/graphdef_create.py