tvm_ffi.access_path#

Access path classes.

Classes

AccessKind(value[, names, module, qualname, ...])

Kinds of access steps in an access path.

AccessPath()

Access path container.

AccessStep(*args, **kwargs)

Access step container.

class tvm_ffi.access_path.AccessKind(value, names=_not_given, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: IntEnum

Kinds of access steps in an access path.

ATTR = 0#
ARRAY_ITEM = 1#
MAP_ITEM = 2#
ATTR_MISSING = 3#
ARRAY_ITEM_MISSING = 4#
MAP_ITEM_MISSING = 5#
class tvm_ffi.access_path.AccessStep(*args, **kwargs)[source]#

Bases: Object

Access step container.

Parameters:
property kind#
property key#
class tvm_ffi.access_path.AccessPath[source]#

Bases: Object

Access path container.

property parent#
property step#
property depth#
static root()[source]#

Create a root access path.

Return type:

AccessPath

is_prefix_of(other)[source]#

Check if this access path is a prefix of another access path.

Parameters:

other (AccessPath) – The access path to check if it is a prefix of this access path

Return type:

bool

Returns:

bool – True if this access path is a prefix of the other access path, False otherwise

attr(attr_key)[source]#

Create an access path to the attribute of the current object.

Parameters:

attr_key (str) – The key of the attribute to access

Return type:

AccessPath

Returns:

AccessPath – The extended access path

attr_missing(attr_key)[source]#

Create an access path that indicate an attribute is missing.

Parameters:

attr_key (str) – The key of the attribute to access

Return type:

AccessPath

Returns:

AccessPath – The extended access path

array_item(index)[source]#

Create an access path to the item of the current array.

Parameters:

index (int) – The index of the item to access

Return type:

AccessPath

Returns:

AccessPath – The extended access path

array_item_missing(index)[source]#

Create an access path that indicate an array item is missing.

Parameters:

index (int) – The index of the item to access

Return type:

AccessPath

Returns:

AccessPath – The extended access path

map_item(key)[source]#

Create an access path to the item of the current map.

Parameters:

key (Any) – The key of the item to access

Return type:

AccessPath

Returns:

AccessPath – The extended access path

map_item_missing(key)[source]#

Create an access path that indicate a map item is missing.

Parameters:

key (Any) – The key of the item to access

Return type:

AccessPath

Returns:

AccessPath – The extended access path

to_steps()[source]#

Convert the access path to a list of access steps.

Return type:

Sequence[AccessStep]

Returns:

access_steps – The list of access steps