| @@ -129,15 +129,23 @@ namespace Tensorflow | |||||
| // for ops that do not have gradients. | // for ops that do not have gradients. | ||||
| var grad_fn = ops.get_gradient_function(op); | var grad_fn = ops.get_gradient_function(op); | ||||
| Python.with<ops.name_scope>(new ops.name_scope(op.Name + "_grad"), delegate | |||||
| Python.with<ops.name_scope>(new ops.name_scope(op.Name + "_grad"), scope1 => | |||||
| { | { | ||||
| string name1 = scope1; | |||||
| if (grad_fn != null) | if (grad_fn != null) | ||||
| { | { | ||||
| in_grads = _MaybeCompile(grad_scope, op, out_grads[0], null, grad_fn); | in_grads = _MaybeCompile(grad_scope, op, out_grads[0], null, grad_fn); | ||||
| _VerifyGeneratedGradients(in_grads, op); | _VerifyGeneratedGradients(in_grads, op); | ||||
| } | } | ||||
| if (gate_gradients) | |||||
| { | |||||
| } | |||||
| }); | }); | ||||
| // temp fix name scope | |||||
| op.Graph._name_stack = "gradients"; | |||||
| } | } | ||||
| } | } | ||||
| else | else | ||||
| @@ -93,6 +93,8 @@ namespace Tensorflow | |||||
| foreach (var attr_def in op_def.Attr) | foreach (var attr_def in op_def.Attr) | ||||
| { | { | ||||
| var key = attr_def.Name; | var key = attr_def.Name; | ||||
| if (!attrs.ContainsKey(key)) | |||||
| Console.WriteLine($"{key} not found in attr_def."); | |||||
| var value = attrs[key]; | var value = attrs[key]; | ||||
| var attr_value = new AttrValue(); | var attr_value = new AttrValue(); | ||||
| @@ -99,7 +99,7 @@ namespace Tensorflow | |||||
| // result = gen_array_ops.shape(); | // result = gen_array_ops.shape(); | ||||
| } | } | ||||
| return null; | |||||
| return gen_array_ops.shape(input); | |||||
| }); | }); | ||||
| } | } | ||||
| @@ -80,6 +80,12 @@ namespace Tensorflow | |||||
| return _op.outputs[0]; | return _op.outputs[0]; | ||||
| } | } | ||||
| public static Tensor shape(Tensor input, TF_DataType out_type = TF_DataType.TF_INT32, string name = "") | |||||
| { | |||||
| var _op = _op_def_lib._apply_op_helper("Shape", name, new { input, out_type }); | |||||
| return _op.outputs[0]; | |||||
| } | |||||
| public static Tensor size(Tensor input, TF_DataType out_type = TF_DataType.TF_INT32, string name = "") | public static Tensor size(Tensor input, TF_DataType out_type = TF_DataType.TF_INT32, string name = "") | ||||
| { | { | ||||
| var _op = _op_def_lib._apply_op_helper("Size", name, new { input, out_type }); | var _op = _op_def_lib._apply_op_helper("Size", name, new { input, out_type }); | ||||
| @@ -45,6 +45,13 @@ namespace Tensorflow | |||||
| return _op.outputs[0]; | return _op.outputs[0]; | ||||
| } | } | ||||
| public static Tensor floor_mod(Tensor x, Tensor y, string name = "") | |||||
| { | |||||
| var _op = _op_def_lib._apply_op_helper("FloorMod", name, args: new { x, y }); | |||||
| return _op.outputs[0]; | |||||
| } | |||||
| /// <summary> | /// <summary> | ||||
| /// Multiply the matrix "a" by the matrix "b". | /// Multiply the matrix "a" by the matrix "b". | ||||
| /// </summary> | /// </summary> | ||||
| @@ -19,6 +19,7 @@ namespace Tensorflow | |||||
| var input_rank = array_ops.size(input_shape); | var input_rank = array_ops.size(input_shape); | ||||
| axes = (axes + input_rank) % input_rank; | axes = (axes + input_rank) % input_rank; | ||||
| var axes_shape = array_ops.shape(axes); | |||||
| return null; | return null; | ||||
| } | } | ||||
| @@ -79,7 +79,10 @@ namespace Tensorflow | |||||
| public static Tensor operator %(Tensor x, Tensor y) | public static Tensor operator %(Tensor x, Tensor y) | ||||
| { | { | ||||
| throw new NotImplementedException("math mod is not implemented"); | |||||
| return Python.with<ops.name_scope, Tensor>(new ops.name_scope("", "mod", new object[] { x, y }), scope => | |||||
| { | |||||
| return gen_math_ops.floor_mod(x, y, scope); | |||||
| }); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -23,7 +23,7 @@ namespace Tensorflow | |||||
| /// <returns></returns> | /// <returns></returns> | ||||
| public bool is_fully_defined() | public bool is_fully_defined() | ||||
| { | { | ||||
| return Dimensions != null && Dimensions.Count(x => x > 0) > 0; | |||||
| return Dimensions != null && Dimensions.Count(x => x < 1) == 0; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||