Skip to content

Commit

Permalink
[Tensor] Fix incorrect cast in assert
Browse files Browse the repository at this point in the history
  • Loading branch information
jfix71 committed Mar 29, 2019
1 parent 851aa36 commit 980b630
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/glow/Base/Tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -809,8 +809,8 @@ template <class ElemTy> class Handle final {
typename std::enable_if<std::is_integral<T>::value>::type
randomize(int low, int high, PseudoRNG &PRNG) {
assert(low < high && "invalid range");
assert(static_cast<ElemTy>(low) >= std::numeric_limits<ElemTy>::lowest() &&
static_cast<ElemTy>(high) <= std::numeric_limits<ElemTy>::max() &&
assert(low >= std::numeric_limits<ElemTy>::lowest() &&
high <= std::numeric_limits<ElemTy>::max() &&
"Cannot initialize outside range of representable values.");
std::uniform_int_distribution<int> dist(low, high);
switch (getElementType()) {
Expand Down

0 comments on commit 980b630

Please sign in to comment.