tvm.tensor

Tensor and Operation class for computation declaration.

class tvm.tensor.Tensor

Tensor object, to construct, see function.Tensor

astype(dtype)

Cast the expression to other type.

Parameters

dtype (str) – The type of new expression

Returns

expr – Expression with new type

Return type

Expr

property axis

Axis of the tensor.

equal(other)

Build an equal check expression with other expr.

Parameters

other (Expr) – The other expression

Returns

ret – The equality expression.

Return type

Expr

property ndim

Dimension of the tensor.

property op

The corressponding Operation.

same_as(other)

check object identity equality

property shape

The output shape of the tensor.

property value_index

The output value index the tensor corresponds to.

class tvm.tensor.Operation

Represent an operation that generates a tensor

property input_tensors

List of input tensors to this op.

property num_outputs

Number of outputs from this op.

output(index)

Get the index-th output of the operation

Parameters

index (int) – The index size.

Returns

out – The i-th output.

Return type

Tensor

same_as(other)

check object identity equality

class tvm.tensor.ComputeOp

Bases: tvm.tensor.BaseComputeOp

Scalar operation.

class tvm.tensor.PlaceholderOp

Bases: tvm.tensor.Operation

Placeholder operation.

class tvm.tensor.ScanOp

Bases: tvm.tensor.Operation

Scan operation.

property scan_axis

Represent the scan axis, only defined when it is a ScanOp

class tvm.tensor.ExternOp

Bases: tvm.tensor.Operation

External operation.