Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Relax AST (apache#2)
Browse files Browse the repository at this point in the history
Co-authored-by: ZihengJiang <ziheng@apache.org>
2 people authored and YuchenJin committed Nov 17, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 97a96ea commit cb03c5e
Showing 19 changed files with 1,185 additions and 7 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -317,6 +317,7 @@ tvm_file_glob(GLOB_RECURSE RELAY_IR_SRCS
tvm_file_glob(GLOB_RECURSE RELAY_QNN_SRCS
src/relay/qnn/*.cc
)

list(APPEND COMPILER_SRCS ${RELAY_OP_SRCS})
list(APPEND COMPILER_SRCS ${RELAY_PASS_SRCS})
list(APPEND COMPILER_SRCS ${RELAY_BACKEND_SRCS})
18 changes: 18 additions & 0 deletions include/tvm/ir/expr.h
Original file line number Diff line number Diff line change
@@ -133,6 +133,7 @@ class PrimExpr : public BaseExpr {
TVM_DLL static PrimExpr FromObject_(ObjectRef ref);
};

class RelayExpr;
/*!
* \brief add operator
*
@@ -365,10 +366,27 @@ class RelayExprNode : public BaseExprNode {
* This value is discarded during serialization.
*/
mutable Type checked_type_ = Type(nullptr);

/*!
* \brief Stores the result of static shape analysis.
*
* \note The value will be optional if a static shape can not be inferred.
* use .shape() instead to acesss an always defined shape expression.
*/
Optional<Array<PrimExpr>> shape_ = Optional<Array<PrimExpr>>();

/*!
* \return The checked_type
*/
inline const Type& checked_type() const;

/*!
* \return An expression which corresponds to the shape of the expression.
*
* Only valid when the expression's type is a Tensor.
*/
inline RelayExpr shape() const;

/*!
* \brief Check if the inferred(checked) type of the Expr
* is backed by a TTypeNode and return it.
4 changes: 2 additions & 2 deletions include/tvm/node/structural_hash.h
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
* under the License.
*/
/*!
* \file tvm/node/structural_equal.h
* \file tvm/node/structural_hash.h
* \brief Structural hash class.
*/
#ifndef TVM_NODE_STRUCTURAL_HASH_H_
@@ -174,7 +174,7 @@ class SHashReducer {
/*!
* \brief Push hash of key to the current sequence of hash values.
* \param key The key to be hashed.
* \note This function indicate key could contain var defintions.
* \note This function indicates key could contain variable defintions.
*/
void DefHash(const ObjectRef& key) const { return handler_->SHashReduce(key, true); }
/*!
Loading

0 comments on commit cb03c5e

Please sign in to comment.