Skip to content

Commit

Permalink
Explicity specify type in std::max template to avoid platform depende…
Browse files Browse the repository at this point in the history
…nt compilation error
  • Loading branch information
Ubuntu authored and apeforest committed Aug 2, 2018
1 parent 74ae95a commit 2f62006
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/operator/convolution_v1-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,12 @@ class ConvolutionV1Op : public Operator {
oshape[2] * oshape[3]);
// param_.workspace is in elements of sizeof(DType)
// if param_.workspace is set to zero the nstep_ equals ishape[0] (batch)
nstep_ = std::max(
nstep_ = std::max<index_t>(
std::min(
static_cast<index_t>(
param_.workspace / (shape_colunit_.Size() + shape_dstunit_.Size())),
ishape[0]),
1LL);
1);

mshadow::Shape<2> scol = mshadow::Shape2(shape_colunit_[0],
shape_colunit_[1] * nstep_);
Expand Down
4 changes: 2 additions & 2 deletions src/operator/nn/deconvolution-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -458,12 +458,12 @@ class DeconvolutionOp {
oshape[1] / param_.num_group,
oshape[2] * oshape[3]);
// See convolution for workspace calculations. nstep_ will be the effective batch size
nstep_ = std::max(
nstep_ = std::max<index_t>(
std::min(
static_cast<index_t>(
param_.workspace / (shape_colunit_.Size() + shape_dstunit_.Size())),
ishape[0]),
1LL);
1);

mshadow::Shape<2> scol = mshadow::Shape2(shape_colunit_[0],
shape_colunit_[1] * nstep_);
Expand Down

0 comments on commit 2f62006

Please sign in to comment.