Skip to content

Commit

Permalink
Merge pull request apache#107 from tqchen/master
Browse files Browse the repository at this point in the history
Add ProdShape
  • Loading branch information
tqchen committed Apr 11, 2016
2 parents 9ff5a2f + 202d06f commit 68d900f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions mshadow/tensor_blob.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,19 @@ struct TShape {
s.shape_[0] = ymax;
return s;
}
/*!
* \return product shape in [dimstart,dimend)
* \param dimstart start dimension
* \param dimend end dimension
*/
inline index_t ProdShape(int dimstart, int dimend) const {
index_t num = 1;
const index_t *d = this->data();
for (int i = dimstart; i < dimend; ++i) {
num *= d[i];
}
return num;
}
/*!
* \brief get the shape of tensor specifying dim
* \return the shape requested
Expand Down

0 comments on commit 68d900f

Please sign in to comment.