diff --git a/examples/ptb.cpp b/examples/ptb.cpp index aae5225b60..1674351582 100644 --- a/examples/ptb.cpp +++ b/examples/ptb.cpp @@ -100,7 +100,7 @@ unsigned loadPTB(Tensor &inputWords, Tensor &targetWords, size_t numSteps, void debug(Node *node) { std::cout << (std::string)node->getName(); - for (int i = 0; i < node->dims().size(); i++) { + for (size_t i = 0; i < node->dims().size(); i++) { std::cout << " " << node->dims()[i]; } std::cout << std::endl; @@ -239,7 +239,7 @@ void testPTB() { std::cout << "Training for " << numBatches << " rounds" << std::endl; - for (int iter = 0; iter < numEpochs; iter++) { + for (size_t iter = 0; iter < numEpochs; iter++) { std::cout << "Training - iteration #" << (iter + 1) << std::endl; llvm::Timer timer("Training", "Training"); diff --git a/src/glow/Graph/Graph.cpp b/src/glow/Graph/Graph.cpp index 1033b633d3..9b47fc3987 100644 --- a/src/glow/Graph/Graph.cpp +++ b/src/glow/Graph/Graph.cpp @@ -375,8 +375,8 @@ BatchedMatMulNode *Graph::createBatchedMatMul(llvm::StringRef name, size_t b1 = RDims[1]; size_t b2 = RDims[2]; - assert(a0 == 1 || b0 == 1 || - a0 == b0 && "Batch size must be broadcasted or identical"); + assert(((a0 == 1) || (b0 == 1) || (a0 == b0)) && + "Batch size must be broadcasted or identical"); // Select the batch size. If the left operand is broadcast (value 1), select // the RHS. diff --git a/src/glow/IR/Instrs.cpp b/src/glow/IR/Instrs.cpp index 4bd8db55bd..175967656e 100644 --- a/src/glow/IR/Instrs.cpp +++ b/src/glow/IR/Instrs.cpp @@ -172,8 +172,8 @@ void BatchedMatMulInst::verify() const { size_t c1 = DDims[1]; size_t c2 = DDims[2]; - assert(a0 == 1 || b0 == 1 || - a0 == b0 && "Batch size must be broadcasted or identical"); + assert(((a0 == 1) || (b0 == 1) || (a0 == b0)) && + "Batch size must be broadcasted or identical"); // Select the batch size. If the left operand is broadcast (value 1), select // the RHS. diff --git a/src/glow/Optimizer/GraphOptimizer.cpp b/src/glow/Optimizer/GraphOptimizer.cpp index fcedcb3695..7e01b99634 100644 --- a/src/glow/Optimizer/GraphOptimizer.cpp +++ b/src/glow/Optimizer/GraphOptimizer.cpp @@ -496,7 +496,7 @@ struct CSEVisitor : NodeWalker { // Replace current node by a found node, which is // equivalent to it. assert(N->isEqual(*FoundN)); - for (int i = 0; i < N->getNumRes(); i++) { + for (unsigned i = 0; i < N->getNumRes(); i++) { NodeValue FV(FoundN, i); NodeValue(N, i).replaceAllUsesOfWith(FV); }