26 #ifndef TVM_NODE_OBJECT_PATH_H_
27 #define TVM_NODE_OBJECT_PATH_H_
37 using runtime::Object;
38 using runtime::ObjectPtr;
39 using runtime::ObjectRef;
164 static constexpr
const char*
_type_key =
"AttributeAccessPath";
184 static constexpr
const char*
_type_key =
"UnknownAttributeAccessPath";
207 static constexpr
const char*
_type_key =
"ArrayIndexPath";
229 static constexpr
const char*
_type_key =
"MissingArrayElementPath";
252 static constexpr
const char*
_type_key =
"MapValuePath";
271 static constexpr
const char*
_type_key =
"MissingMapEntryPath";
Definition: object_path.h:200
bool LastNodeEqual(const ObjectPathNode *other) const final
TVM_DECLARE_FINAL_OBJECT_INFO(ArrayIndexPathNode, ObjectPathNode)
int32_t index
Index of the array element that is being accessed.
Definition: object_path.h:203
ArrayIndexPathNode(const ObjectPathNode *parent, int32_t index)
std::string LastNodeString() const final
Definition: object_path.h:215
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(ArrayIndexPath, ObjectPath, ArrayIndexPathNode)
Definition: object_path.h:157
bool LastNodeEqual(const ObjectPathNode *other) const final
String attr_key
Name of the attribute being accessed. Must be a static string.
Definition: object_path.h:160
AttributeAccessPathNode(const ObjectPathNode *parent, String attr_key)
TVM_DECLARE_FINAL_OBJECT_INFO(AttributeAccessPathNode, ObjectPathNode)
std::string LastNodeString() const final
Definition: object_path.h:172
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(AttributeAccessPath, ObjectPath, AttributeAccessPathNode)
Definition: object_path.h:245
TVM_DECLARE_FINAL_OBJECT_INFO(MapValuePathNode, ObjectPathNode)
std::string LastNodeString() const final
ObjectRef key
Key of the map entry that is being accessed.
Definition: object_path.h:248
bool LastNodeEqual(const ObjectPathNode *other) const final
MapValuePathNode(const ObjectPathNode *parent, ObjectRef key)
Definition: object_path.h:260
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(MapValuePath, ObjectPath, MapValuePathNode)
Definition: object_path.h:222
TVM_DECLARE_FINAL_OBJECT_INFO(MissingArrayElementPathNode, ObjectPathNode)
int32_t index
Index of the array element that is missing.
Definition: object_path.h:225
MissingArrayElementPathNode(const ObjectPathNode *parent, int32_t index)
bool LastNodeEqual(const ObjectPathNode *other) const final
std::string LastNodeString() const final
Definition: object_path.h:237
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(MissingArrayElementPath, ObjectPath, MissingArrayElementPathNode)
Definition: object_path.h:267
bool LastNodeEqual(const ObjectPathNode *other) const final
TVM_DECLARE_FINAL_OBJECT_INFO(MissingMapEntryPathNode, ObjectPathNode)
std::string LastNodeString() const final
MissingMapEntryPathNode(const ObjectPathNode *parent)
Definition: object_path.h:279
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(MissingMapEntryPath, ObjectPath, MissingMapEntryPathNode)
Path to an object from some root object.
Definition: object_path.h:55
friend std::string GetObjectPathRepr(const ObjectPathNode *node)
ObjectPathNode(const ObjectPathNode *parent)
bool IsPrefixOf(const ObjectPath &other) const
Check if this path is a prefix of another path.
Optional< ObjectPath > GetParent() const
Get the parent path.
const ObjectPathNode * ParentNode() const
ObjectPath MissingMapEntry() const
Extend this path with access to a missing map entry.
TVM_DECLARE_BASE_OBJECT_INFO(ObjectPathNode, Object)
ObjectPath MapValue(ObjectRef key) const
Extend this path with access to a map value.
int32_t Length() const
Get the length of the path.
ObjectPath Attr(const char *attr_key) const
Extend this path with access to an object attribute.
virtual std::string LastNodeString() const =0
ObjectPath GetPrefix(int32_t length) const
Get a path prefix of the given length.
virtual bool LastNodeEqual(const ObjectPathNode *other) const =0
ObjectPath Attr(Optional< String > attr_key) const
Extend this path with access to an object attribute.
ObjectPath MissingArrayElement(int32_t index) const
Extend this path with access to a missing array element.
static constexpr const char * _type_key
Definition: object_path.h:101
ObjectPath ArrayIndex(int32_t index) const
Extend this path with access to an array element.
bool PathsEqual(const ObjectPath &other) const
Check if two paths are equal.
Definition: object_path.h:122
static ObjectPath Root(Optional< String > name=NullOpt)
Create a path that represents the root object itself.
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(ObjectPath, ObjectRef, ObjectPathNode)
Definition: object_path.h:136
Optional< String > name
Definition: object_path.h:138
RootPathNode(Optional< String > name=NullOpt)
TVM_DECLARE_FINAL_OBJECT_INFO(RootPathNode, ObjectPathNode)
std::string LastNodeString() const final
static constexpr const char * _type_key
Definition: object_path.h:142
bool LastNodeEqual(const ObjectPathNode *other) const final
Definition: object_path.h:150
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(RootPath, ObjectPath, RootPathNode)
Definition: object_path.h:180
bool LastNodeEqual(const ObjectPathNode *other) const final
UnknownAttributeAccessPathNode(const ObjectPathNode *parent)
TVM_DECLARE_FINAL_OBJECT_INFO(UnknownAttributeAccessPathNode, ObjectPathNode)
std::string LastNodeString() const final
Definition: object_path.h:192
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(UnknownAttributeAccessPath, ObjectPath, UnknownAttributeAccessPathNode)
Base class of all object reference.
Definition: object.h:519
base class of all object containers.
Definition: object.h:171
Optional container that to represent to a Nullable variant of T.
Definition: optional.h:51
Reference to string objects.
Definition: string.h:98
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
constexpr runtime::NullOptType NullOpt
Definition: optional.h:169
A managed object in the TVM runtime.
Runtime Optional container types.
Runtime String container types.