-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use .data() method to access elements by ordinal in tensor_reduce fun…
…ction.
- Loading branch information
1 parent
6e18686
commit 2520fe5
Showing
1 changed file
with
2 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -787,8 +787,8 @@ auto tensor_reduce(ReduceOp&& reduce_op, JoinOp&& join_op, | |
auto result = identity; | ||
for (decltype(tensor1.range().volume()) ord = 0ul; ord < volume; ++ord) { | ||
auto temp = | ||
tensor_reduce(reduce_op, join_op, identity, tensor1.at_ordinal(ord), | ||
tensors.at_ordinal(ord)...); | ||
tensor_reduce(reduce_op, join_op, identity, tensor1.data()[ord], | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
evaleev
Member
|
||
tensors.data()[ord]...); | ||
join_op(result, temp); | ||
} | ||
|
||
|
I think the "correct" way to deal with the issue of
at_ordinal
not working whenbatch_size()>1
is to implement alternative tonorm()
whenbatch_size()>1
to custom function (likenorm_batch(batch_reducer)
... this does not really do the right thing for the case wherebatch_size() > 1
(recall, as we discussed,norm()
needs to return norm maximum over the batches, i.e. you would invokeTensor<T>::norm_batch(std::max<T>{})