diff options
Diffstat (limited to 'chapters/reduction.adoc')
-rw-r--r-- | chapters/reduction.adoc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/chapters/reduction.adoc b/chapters/reduction.adoc index bef68a3..a9687b1 100644 --- a/chapters/reduction.adoc +++ b/chapters/reduction.adoc @@ -9,9 +9,9 @@ === Reduction Operators -==== REDUCE_ANY +==== REDUCE_ALL -Reduce a tensor along the given axes with a logical OR operation +Reduce a tensor along the given axes with a logical AND operation *Arguments:* @@ -34,7 +34,7 @@ for_each (axis in axes[]) { } if (keep_dims) assert(tmp_shape == out_shape) for_each (index in tmp_shape) { - tensor_write<in_t>(output, tmp_shape, index, false) + tensor_write<in_t>(output, tmp_shape, index, true) } for_each (index in in_shape) { tmp_index = index; @@ -43,7 +43,7 @@ for_each (index in in_shape) { } value = tensor_read<in_t>(input, in_shape, index) acc = tensor_read<in_t>(output, tmp_shape, tmp_index) - acc = acc || value + acc = acc && value tensor_write<in_t>(output, tmp_shape, tmp_index, acc) } ---- @@ -56,9 +56,9 @@ for_each (index in in_shape) { |Any|Boolean|bool|bool |=== -==== REDUCE_ALL +==== REDUCE_ANY -Reduce a tensor along the given axes with a logical AND operation +Reduce a tensor along the given axes with a logical OR operation *Arguments:* @@ -81,7 +81,7 @@ for_each (axis in axes[]) { } if (keep_dims) assert(tmp_shape == out_shape) for_each (index in tmp_shape) { - tensor_write<in_t>(output, tmp_shape, index, true) + tensor_write<in_t>(output, tmp_shape, index, false) } for_each (index in in_shape) { tmp_index = index; @@ -90,7 +90,7 @@ for_each (index in in_shape) { } value = tensor_read<in_t>(input, in_shape, index) acc = tensor_read<in_t>(output, tmp_shape, tmp_index) - acc = acc && value + acc = acc || value tensor_write<in_t>(output, tmp_shape, tmp_index, acc) } ---- |