Skip to content

Commit

Permalink
Use isFPType() instead of checking for FP32 in a couple of asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
opti-mix committed Oct 24, 2018
1 parent c799272 commit 984f62b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions lib/Graph/Graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1422,8 +1422,7 @@ BatchOneHotNode *Function::createBatchOneHot(llvm::StringRef name,

QuantizeNode *Function::createQuantize(llvm::StringRef name, NodeValue input,
TypeRef outTy) {
assert(input.getElementType() == ElemKind::FloatTy &&
"Input must be a floating type");
assert(input.getType()->isFPType() && "Input must be a floating type");
assert(outTy->getElementType() == ElemKind::Int8QTy &&
"Output must be a quantized type");
assert(input.dims().equals(outTy->dims()) &&
Expand Down
8 changes: 4 additions & 4 deletions lib/Graph/Nodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,14 +644,14 @@ void IntLookupTableNode::verify() const {
void QuantizeNode::verify() const {
// Dest must be quantized.
checkType(getResult(), ElemKind::Int8QTy);
// Src must be float.
checkType(getInput(), ElemKind::FloatTy);
// Src must be an FP type.
assert(getInput().getType()->isFPType() && "Invalid type");
checkSameShape(getResult(), getInput());
}

void DequantizeNode::verify() const {
// Dest must be float.
checkType(getResult(), ElemKind::FloatTy);
// Dest must be an FP type.
assert(getResult().getType()->isFPType() && "Invalid type");
// Src must be quantized.
checkType(getInput(), ElemKind::Int8QTy);
checkSameShape(getResult(), getInput());
Expand Down

0 comments on commit 984f62b

Please sign in to comment.