tvm
Namespaces | Functions
transform.h File Reference

Transform op constructors. More...

#include <tvm/arith/analyzer.h>
#include <tvm/te/operation.h>
#include <tvm/tir/data_layout.h>
#include <tvm/tir/index_map.h>
#include <tvm/topi/broadcast.h>
#include <tvm/topi/detail/broadcast.h>
#include <tvm/topi/detail/constant_utils.h>
#include <tvm/topi/detail/ravel_unravel.h>
#include <tvm/topi/detail/strided_slice.h>
#include <tvm/topi/detail/tensor_utils.h>
#include <tvm/topi/tags.h>
#include <algorithm>
#include <iterator>
#include <limits>
#include <string>
#include <unordered_set>
#include <vector>
#include "tvm/ir/expr.h"
#include "tvm/runtime/data_type.h"
#include "tvm/tir/expr.h"
#include "tvm/tir/op.h"
#include "tvm/tir/var.h"
Include dependency graph for transform.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 tvm
 runtime implementation for LibTorch/TorchScript.
 
 tvm::topi
 
 tvm::topi::relax
 

Functions

Tensor tvm::topi::sliding_window (const Tensor &x, int axis, Array< Integer > window_shape, Array< Integer > strides, std::string name="T_sliding_window", std::string tag="")
 Creates an operation to slide a window over the input x. More...
 
Tensor tvm::topi::expand_dims (const Tensor &x, int axis, int num_newaxis=1, std::string name="T_expand_dims", std::string tag=kBroadcast)
 Creates an operation to insert new dimensions of length 1. More...
 
Tensor tvm::topi::transpose (const Tensor &x, Array< Integer > axes, std::string name="T_transpose", std::string tag=kInjective)
 Permute the dimensions of an array. More...
 
Tensor tvm::topi::reverse_sequence (const Tensor &x, const Tensor &seq_lengths, int seq_axis=1, int batch_axis=0, std::string name="T_reverse_sequence", std::string tag=kInjective)
 Reverse the tensor for variable length slices. Input is first sliced along batch axis and then elements are reversed along seq axis. More...
 
Tensor tvm::topi::reshape (const Tensor &x, Array< PrimExpr > newshape, std::string name="T_reshape", std::string tag=kInjective)
 Reshape a tensor. More...
 
Tensor tvm::topi::unravel_index (const Tensor &x, const Tensor &shape, std::string name="T_unravel", std::string tag=kInjective)
 Converts a flat index or array of flat indices into a tuple of coordinate arrays. More...
 
Tensor tvm::topi::squeeze (const Tensor &x, Array< Integer > axis, bool atleast1d=false, std::string name="T_squeeze", std::string tag=kInjective)
 Remove size 1 dimensions from the shape of a tensor. The removed dimensions must have a constant size of 1. More...
 
Tensor tvm::topi::concatenate (const Array< Tensor > &inputs, int axis=0, std::string name="T_concat", std::string tag=kInjective)
 Join a sequence of tensors along an existing axis. More...
 
Tensor tvm::topi::stack (const Array< Tensor > &inputs, int axis=0, std::string name="T_stack", std::string tag=kInjective)
 Join a sequence of tensors along a new axis. More...
 
Array< Tensortvm::topi::split (const Tensor &x, Array< PrimExpr > split_indices, int axis, std::string name="T_split", std::string tag=kInjective)
 Split a tensor into multiple sub-tensors. More...
 
PrimExpr tvm::topi::DynamicCanonicalizeIndex (PrimExpr index, PrimExpr extent, PrimExpr stride)
 
int64_t tvm::topi::StaticCanonicalizeIndex (int64_t index, int64_t extent, int64_t stride)
 
PrimExpr tvm::topi::CanonicalizeIndex (PrimExpr index, PrimExpr extent, PrimExpr stride)
 
PrimExpr tvm::topi::GetLength (PrimExpr begin, PrimExpr end, PrimExpr stride, PrimExpr extent, bool assume_inbound=true)
 
Tensor tvm::topi::dynamic_strided_slice_with_axes (const Tensor &x, const Array< PrimExpr > &begin, const Array< PrimExpr > &end, const Array< PrimExpr > &strides, const Array< Integer > &axes, bool assume_inbound=true, std::string name="T_dynamic_strided_slice_with_axes", std::string tag=kInjective)
 strided_slice of a tensor where begin/end/stride can be mixed static and dynamic More...
 
Tensor tvm::topi::dynamic_strided_slice (const Tensor &x, const Array< PrimExpr > &begin, const Array< PrimExpr > &end, const Array< PrimExpr > &strides, bool assume_inbound=true, std::string name="T_dynamic_strided_slice", std::string tag=kInjective)
 strided_slice of a tensor where begin/end/stride can be mixed static and dynamic More...
 
te::Tensor tvm::topi::dynamic_strided_slice (const te::Tensor &x, const te::Tensor &begin, const te::Tensor &end, const te::Tensor &strides, bool assume_inbound=true, std::string name="T_strided_slice_dynamic", std::string tag=topi::kInjective)
 strided_slice of a tensor with dynamic begin/end/stride More...
 
Array< PrimExpr > tvm::topi::StridedSliceOutputShape (const Array< PrimExpr > &ishape, const Array< Integer > &begin, const Array< Integer > &end, const Array< Integer > &strides, const Array< Integer > &axes, const std::string &slice_mode)
 Calculate the output shape of strided_slice, the entry point for Relay type relation. More...
 
Tensor tvm::topi::strided_slice_with_axes (const Tensor &x, const Array< Integer > &begin, const Array< Integer > &end, const Array< Integer > &strides, const Array< Integer > &axes, std::string slice_mode="end", std::string name="T_strided_slice_with_axes", std::string tag=kInjective)
 strided_slice of a tensor More...
 
Tensor tvm::topi::strided_slice (const Tensor &x, const Array< Integer > &begin, const Array< Integer > &end, const Array< Integer > &strides, std::string slice_mode="end", std::string name="T_strided_slice", std::string tag=kInjective)
 strided_slice of a tensor More...
 
Array< Tensortvm::topi::split_sections (const Tensor &x, int num_sections, int axis, std::string name="T_split_sections", std::string tag=kInjective)
 Split a tensor into a number of sub-tensors. More...
 
Tensor tvm::topi::take (const Tensor &a, const Tensor &indices, int batch_dims, std::string mode="clip", std::string name="T_take", std::string tag=kInjective)
 Take elements from an flattened input array when axis is None. More...
 
Tensor tvm::topi::sequence_mask (const Tensor &data, const Tensor &valid_length, double mask_value, int axis, std::string name="T_sequence_mask", std::string tag=kInjective)
 Mask the out-of-boundary elements of each sequence. More...
 
Tensor tvm::topi::take (const Tensor &a, Variant< Tensor, PrimExpr > indices, int batch_dims, int axis, std::string mode="clip", std::string name="T_take", std::string tag=kInjective)
 Take elements from an array along an axis. More...
 
Tensor tvm::topi::where (const Tensor &condition, const Tensor &x, const Tensor &y, std::string name="T_where", std::string tag=kBroadcast)
 Return the elements, either from x or y, depending on the condition. More...
 
Tensor tvm::topi::repeat (const Tensor &x, int repeats, int axis, std::string name="T_repeat", std::string tag=kBroadcast)
 Creates an operation to repeat elements of an array. More...
 
Tensor tvm::topi::tile (const Tensor &x, Array< Integer > reps, std::string name="T_tile", std::string tag=kBroadcast)
 Creates an operation to tile elements of an array. More...
 
Tensor tvm::topi::dyn_tile (const Tensor &x, Array< PrimExpr > new_shape, size_t rdim, std::string name="T_tile", std::string tag=kBroadcast)
 Creates an operation to tile elements of an array. More...
 
Tensor tvm::topi::gather (const Tensor &data, int axis, const Tensor &indices, std::string name="T_gather", std::string tag=kInjective)
 Gather values along given axis from given indices. More...
 
Tensor tvm::topi::gather_nd (const Tensor &data, const Tensor &indices, int batch_dims=0, std::string name="T_gather_nd", std::string tag=kInjective)
 Gather elements from a n-dimension array. More...
 
tvm::te::Tensor tvm::topi::matmul (const tvm::te::Tensor &A, const tvm::te::Tensor &B, bool trans_a=false, bool trans_b=false, std::string name="T_matmul", std::string tag=kMatMul)
 Creates an operation that calculates a matrix multiplication (row-major notation): A(i, k) * B(k, j), if trans_a == trans_b the usual transposed combinations, otherwise. More...
 
Tensor tvm::topi::tensordot (const Tensor &A, const tvm::te::Tensor &B, int axes=2, std::string name="T_tensordot", std::string tag=kMatMul)
 A generalization of matrix multiplication to tensors. More...
 
Tensor tvm::topi::tensordot (const Tensor &A, const tvm::te::Tensor &B, Array< PrimExpr > A_axes, Array< PrimExpr > B_axes, std::string name="T_tensordot", std::string tag=kMatMul)
 A generalization of matrix multiplication to tensors. More...
 
Tensor tvm::topi::arange (const PrimExpr &start, const PrimExpr &stop, const PrimExpr &step, DataType dtype, std::string name="T_arange", std::string tag=kInjective)
 
Array< Tensortvm::topi::meshgrid (const Array< Tensor > &inputs, const std::string &indexing, std::string name="T_meshgrid", std::string tag=kInjective)
 Produce grids by expanding input over dimensions defined by other inputs. More...
 
Tensor tvm::topi::layout_transform (const Tensor &src, const std::string &src_layout, const std::string &dst_layout, const std::string schedule_rule="None", const std::string name="T_layout_trans", const std::string tag=kInjective)
 Transform the layout according to src_layout and dst_layout. More...
 
void tvm::topi::parse_auto_scheduler_layout (const String &layout, Array< PrimExpr > *shape, std::vector< std::string > *axes)
 Utility function for auto_scheduler_layout_transform. More...
 
Tensor tvm::topi::auto_scheduler_layout_transform (const Tensor &src, const String &src_layout, const String &dst_layout, const String name="T_auto_scheduler_layout_trans", const String tag=kInjective)
 Transform the auto-scheduler generated layout according to src_layout and dst_layout. More...
 
Tensor tvm::topi::meta_schedule_layout_transform (const Tensor &src, const tir::IndexMap &index_map, const String name="T_meta_schedule_layout_trans", const String tag=kInjective)
 Transform the meta-schedule generated layout according to TIR's IndexMap. More...
 
Tensor tvm::topi::shape (const Tensor &src, DataType dtype, const std::string name="T_shape", const std::string tag=kInjective)
 Get the shape of input tensor. More...
 
Tensor tvm::topi::ndarray_size (const Tensor &src, const DataType &dtype, const std::string &name="ndarray_size", const std::string &tag=kInjective)
 Get the size of input tensor. More...
 
Tensor tvm::topi::one_hot (const Tensor &indices, const PrimExpr on_value, const PrimExpr off_value, int depth, int axis, const DataType &dtype, Array< PrimExpr > oshape=Array< PrimExpr >(), const std::string name="T_one_hot", const std::string tag=kInjective)
 Returns a one-hot tensor where the locations repsented by indices take value on_value, other locations take value off_value. More...
 
Tensor tvm::topi::sparse_to_dense (const Tensor &sparse_indices, const Array< PrimExpr > &output_shape, const Tensor &sparse_values, const PrimExpr &default_value, const std::string name="T_sparse_to_dense", const std::string tag=kInjective)
 Get a dense tensor. More...
 
Tensor tvm::topi::matrix_set_diag (const Tensor &input, const Tensor &diagonal, int k1, int k2, bool super_diag_right_align, bool sub_diag_right_align, const std::string name="T_matrix_set_diag", const std::string tag=kInjective)
 Returns a tensor with the diagonal of input tensor replaced with the provided diagonals. More...
 
Tensor tvm::topi::adv_index (const Tensor &data, const Array< Tensor > &indices, const std::string name="advanced_index", const std::string tag=kInjective)
 Numpy style advanced indexing with tensor. More...
 
te::Tensor tvm::topi::relax::dynamic_strided_slice (const te::Tensor &x, const te::Tensor &begin, const te::Tensor &end, const te::Tensor &strides, Array< PrimExpr > output_shape, std::string name="T_strided_slice_dynamic", std::string tag=kInjective)
 

Detailed Description

Transform op constructors.