Skip to content

Commit

Permalink
[BE] Fix pointless comparison warning (pytorch#110227)
Browse files Browse the repository at this point in the history
As Indeed `uint32_t(x) >= 0` is always true

Warning typically looks as follows:
```
[337/1379] Building CUDA object caffe2/CMakeFiles/torch_cuda.dir/__/aten/src/ATen/native/cuda/EmbeddingBag.cu.o
../aten/src/ATen/core/ivalue.h(1283): warning pytorch#186-D: pointless comparison of unsigned integer with zero

Remark: The warnings can be suppressed with "-diag-suppress <warning-number>"

```
Pull Request resolved: pytorch#110227
Approved by: https://github.com/atalman, https://github.com/albanD
  • Loading branch information
malfet authored and pytorchmergebot committed Sep 28, 2023
1 parent f82a29e commit 41d6c29
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aten/src/ATen/core/ivalue.h
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ struct TORCH_API IValue final {
0;

TORCH_INTERNAL_ASSERT_DEBUG_ONLY(
uint32_t(tag) >= 0 && uint32_t(tag) < kNumTags,
static_cast<uint32_t>(tag) < kNumTags,
"unexpected tag ",
static_cast<int>(tag));
return kTruthTableBitVector & (1 << (uint32_t(tag) % 32));
Expand Down

0 comments on commit 41d6c29

Please sign in to comment.