Skip to content

Commit d94e357

Browse files
committed
Fix logical or/and usage for MSVC compilation.
The `or`/`and` alternate spellings are not supported on all compilers without additinoal flags (https://learn.microsoft.com/en-us/cpp/cpp/logical-or-operator-pipe-pipe?view=msvc-170#operator-keyword-for-).
1 parent 4f0b79c commit d94e357

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/Conversion/TorchOnnxToTorch/DefaultDomainGtoP.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2346,7 +2346,7 @@ void mlir::torch::onnx_c::populateDefaultDomainGtoP(
23462346
ArrayRef<int64_t> inputShape = inputTensorType.getSizes();
23472347
unsigned inputRank = inputShape.size();
23482348
// only handle 2D, 3D and 5D pooling cases
2349-
if (inputRank > 5 or inputRank < 3) {
2349+
if (inputRank > 5 || inputRank < 3) {
23502350
return failure();
23512351
}
23522352
if (!resultType || !resultType.hasSizes()) {
@@ -2454,7 +2454,7 @@ void mlir::torch::onnx_c::populateDefaultDomainGtoP(
24542454
"Unimplemented: unranked tensor");
24552455
unsigned rank = *maybeRank;
24562456
// only 1D, 2D and 3D LpPool is supported.
2457-
if (rank > 5 or rank < 3) {
2457+
if (rank > 5 || rank < 3) {
24582458
return failure();
24592459
}
24602460

lib/Dialect/Torch/Transforms/DecomposeComplexOps.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9780,16 +9780,16 @@ class DecomposeAtenNllLossForwardOp
97809780
auto targetSizes = targetType.getSizes();
97819781
int64_t selfRank = selfSizes.size();
97829782
int64_t targetRank = targetSizes.size();
9783-
if (selfRank <= 0 or selfRank > 2) {
9783+
if (selfRank <= 0 || selfRank > 2) {
97849784
return rewriter.notifyMatchFailure(op, "input tensor should be 1D or 2D");
97859785
}
97869786
if (targetRank > 1) {
97879787
return rewriter.notifyMatchFailure(op,
97889788
"target tensor shoule be 0D or 1D!");
97899789
}
97909790

9791-
if (selfRank != 1 or targetRank != 0) {
9792-
if (!(selfSizes[0] == kUnknownSize and targetSizes[0] == kUnknownSize) and
9791+
if (selfRank != 1 || targetRank != 0) {
9792+
if (!(selfSizes[0] == kUnknownSize && targetSizes[0] == kUnknownSize) &&
97939793
selfSizes[0] != targetSizes[0]) {
97949794
return rewriter.notifyMatchFailure(
97959795
op,
@@ -9907,7 +9907,7 @@ class DecomposeAtenNllLossForwardOp
99079907
zeroTensor);
99089908

99099909
Value totalWeight;
9910-
if (reduction == 0 and selfRank > 1) {
9910+
if (reduction == 0 && selfRank > 1) {
99119911
auto zeroFloat =
99129912
rewriter.create<ConstantFloatOp>(loc, rewriter.getF64FloatAttr(0.0));
99139913
Value twSize = rewriter.create<PrimListConstructOp>(

0 commit comments

Comments
 (0)