Skip to content

Commit

Permalink
Documentation improvement in caffe2/core/tensor.h (pytorch#11006)
Browse files Browse the repository at this point in the history
Summary:
Signed-off-by: Edward Z. Yang <[email protected]>
Pull Request resolved: pytorch#11006

Reviewed By: smessmer

Differential Revision: D9558383

Pulled By: ezyang

fbshipit-source-id: 7d36fb69a6e8a7d064da2c8796dc263a9fd4e094
  • Loading branch information
ezyang authored and facebook-github-bot committed Aug 29, 2018
1 parent e9eed8e commit 0b1de74
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions caffe2/core/tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ inline vector<TIndex> ToVectorTIndex(const std::vector<int>& src) {
}

/**
* Return product of all dimensions starting from K
* Return product of all dimensions starting from k
*/
inline TIndex size_from_dim_(int k, const vector<TIndex>& dims) {
TIndex r = 1;
Expand All @@ -35,7 +35,7 @@ inline TIndex size_from_dim_(int k, const vector<TIndex>& dims) {
return r;
}

// Product of all dims up to
// Product of all dims up to k (not including dims[k])
inline TIndex size_to_dim_(int k, const vector<TIndex>& dims) {
CAFFE_ENFORCE((unsigned)k <= dims.size());
TIndex r = 1;
Expand All @@ -61,6 +61,7 @@ inline TIndex size_between_dim_(int k, int l, const vector<TIndex>& dims) {
return r;
}

// Wrap around axis_index if it is negative, s.t., -1 is the last dim
inline int canonical_axis_index_(int axis_index, int ndims) {
CAFFE_ENFORCE_GE(axis_index, -ndims);
CAFFE_ENFORCE_LT(axis_index, ndims);
Expand Down

0 comments on commit 0b1de74

Please sign in to comment.