Browse Source

ZeroFraction function fixed

tags/v0.10
Deepak Battini 6 years ago
parent
commit
b430d6f7e8
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/TensorFlowNET.Core/Operations/nn_impl.py.cs

+ 2
- 2
src/TensorFlowNET.Core/Operations/nn_impl.py.cs View File

@@ -152,13 +152,13 @@ namespace Tensorflow
size = gen_math_ops.less_equal(size, dtypes.int32.max());
Tensor num_nonzero = control_flow_ops.cond(
size,
() => math_ops.cast(_count_nonzero(value, dtype: dtypes.int32)),
() => math_ops.cast(_count_nonzero(value, dtype: dtypes.int32), TF_DataType.TF_INT64),
() => _count_nonzero(value, dtype: dtypes.int64)
);

with(ops.name_scope("counts_to_fraction"), count_scope =>
{
var num_zero = size - num_nonzero;
var num_zero = math_ops.subtract(math_ops.cast(size, TF_DataType.TF_INT64), num_nonzero);
var num_zero_float32 = math_ops.cast(num_zero, dtype: dtypes.float32);
var size_float32 = math_ops.cast(size, dtype: dtypes.float32);
zero_fraction_float32 = num_zero_float32 / size_float32;


Loading…
Cancel
Save