tvm.tensor

Tensor and Operation class for computation declaration.

class tvm.tensor.Tensor(handle)

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
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
ndim

Dimension of the tensor.

op

The corressponding Operation.

same_as(other)

check object identity equality

shape

The output shape of the tensor.

value_index

The output value index the tensor corressponds to.

class tvm.tensor.Operation(handle)

Represent an operation that generate a tensor

input_tensors

List of input tensors to this op.

num_outputs

Number of outputs of 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(handle)

Bases: tvm.tensor.Operation

Compute operation.

axis

Represent axis of IterVar, only defined when it is a ComputeOp

reduce_axis

Represent axis of reductions, only defined when it is a ComputeOp

class tvm.tensor.PlaceholderOp(handle)

Bases: tvm.tensor.Operation

Placeholder operation.

class tvm.tensor.ScanOp(handle)

Bases: tvm.tensor.Operation

Scan operation.

scan_axis

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

class tvm.tensor.ExternOp(handle)

Bases: tvm.tensor.Operation

Extern operation.