Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jroesch committed Oct 24, 2018
1 parent eff1ec6 commit 524bac2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
17 changes: 14 additions & 3 deletions include/tvm/relay/op.h
Original file line number Diff line number Diff line change
Expand Up @@ -485,13 +485,24 @@ inline ValueType OpMap<ValueType>::get(const Op& op,
return map_.get<ValueType>(op, def_value);
}

/*!
* \brief Check that an expression is a "primtive operator".
*
* Will return true if the expression is an operator which
* matches the form of primtive operators registered directly
* by the Relay codebase.
*
* That is the arguments are all type variables, and there is a single
* type relation applied to the input and output types.
*/
inline bool IsPrimitiveOp(const Expr& expr) {
if (!expr.as<OpNode>()) {
const auto* op = expr.as<OpNode>();

if (!op) {
return false;
}

auto op = Downcast<Op>(expr);
auto fn_ty = op->op_type;
const auto& fn_ty = op->op_type;
if (fn_ty->type_constraints.size() != 1) return false;

const TypeRelationNode* rel = fn_ty->type_constraints[0].as<TypeRelationNode>();
Expand Down
4 changes: 1 addition & 3 deletions src/relay/pass/type_infer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ TVM_REGISTER_API("tvm.relay.type_relation.TupleGetItem")
struct ResolvedTypeInfo {
explicit ResolvedTypeInfo(Type checked_type, Array<Type> type_args)
: checked_type(checked_type), type_args(type_args) {}
ResolvedTypeInfo(const ResolvedTypeInfo& rti)
: checked_type(rti.checked_type), type_args(rti.type_args) {}
ResolvedTypeInfo() : checked_type() {}
ResolvedTypeInfo() {}

Type checked_type;
// Only allocated when the expression is a call.
Expand Down

0 comments on commit 524bac2

Please sign in to comment.