tvm
Namespaces | Typedefs | Functions
reduction.h File Reference

Reduction op constructors. More...

#include <tvm/te/operation.h>
#include <tvm/topi/broadcast.h>
#include <tvm/topi/detail/constant_utils.h>
#include <tvm/topi/detail/ravel_unravel.h>
#include <tvm/topi/elemwise.h>
#include <tvm/topi/tags.h>
#include <tvm/topi/transform.h>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
Include dependency graph for reduction.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
 

Typedefs

using tvm::topi::FReduce = std::function< PrimExpr(PrimExpr source, const Array< IterVar > &axis, Array< PrimExpr > init, Span span)>
 The operation to use for CommReduce. More...
 
using tvm::topi::FCommReduce = std::function< Array< PrimExpr >(Array< PrimExpr > exprs, const Array< IterVar > &axis, PrimExpr *condition)>
 The operation to use for CommReduceIdx. More...
 
using tvm::topi::FCombine = std::function< Array< PrimExpr >(Array< Var > lhs, Array< Var > rhs)>
 A combiner function for a reduction. More...
 
using tvm::topi::FIdentity = std::function< Array< PrimExpr >(std::vector< DataType > types)>
 An initializer function for a reduction. More...
 

Functions

std::vector< int > tvm::topi::GetRealAxis (int ndim, const Array< Integer > &axis)
 Convert a reduction axis which could be empty or have negative elements into a real axis with valid dimension indices. More...
 
Array< IterVartvm::topi::MakeReduceAxes (const std::vector< int > &real_axis, const Tensor &data)
 Enumerate the axes for a reduce op. More...
 
Array< PrimExpr > tvm::topi::MakeReduceTargetShape (const std::vector< int > &real_axis, const Tensor &data, bool keepdims, bool atleast1d)
 Calculate the target shape for a reduce op. More...
 
Tensor tvm::topi::DoCommReduce (const Tensor &data, FReduce func, const Array< PrimExpr > &target_shape, const std::vector< int > &reduce_axes, const std::vector< int > &squeeze_axes, Span span=Span())
 Create a reduction operation. More...
 
Tensor tvm::topi::CommReduce (const Tensor &data, const Array< Integer > &axis, FReduce func, bool keepdims, bool atleast1d)
 Create a reduction operation. More...
 
Tensor tvm::topi::CommReduceIdx (const Tensor &data, const Array< Integer > &axis, FCommReduce func, bool keepdims, bool atleast1d)
 Create an index reduction operation. More...
 
FCommReduce tvm::topi::MakeCommReducer (FCombine fcombine, FIdentity fidentity, std::string name="reduce")
 Create a commutative reducer for a reduction. More...
 
PrimExpr tvm::topi::MinOp (PrimExpr source, Array< IterVar > axis, Array< PrimExpr > init={}, Span span=Span())
 Wrap tvm::min to ensure we get the correct overload. More...
 
PrimExpr tvm::topi::MaxOp (PrimExpr source, Array< IterVar > axis, Array< PrimExpr > init={}, Span span=Span())
 Wrap tvm::max to ensure we get the correct overload. More...
 
PrimExpr tvm::topi::ProdOp (PrimExpr source, Array< IterVar > axis, Array< PrimExpr > init={}, Span span=Span())
 Wrap tvm::prod to ensure we get the correct overload. More...
 
Tensor tvm::topi::sum (const Tensor &data, const Array< Integer > &axis, bool keepdims=false, bool atleast1d=false)
 Creates an operation that sums array elements over a given axis. More...
 
Tensor tvm::topi::collapse_sum (const Tensor &data, Array< PrimExpr > target_shape)
 
Tensor tvm::topi::all (const Tensor &data, const Array< Integer > &axis, bool keepdims=false, bool atleast1d=false)
 Creates an operation that computes the logical AND of elements over a given axis. More...
 
Tensor tvm::topi::any (const Tensor &data, const Array< Integer > &axis, bool keepdims=false, bool atleast1d=false)
 Creates an operation that computes the logical OR of elements over a given axis. More...
 
Tensor tvm::topi::min (const Tensor &data, const Array< Integer > &axis, bool keepdims=false, bool atleast1d=false)
 Creates an operation that finds the minimum of elements over a given axis. More...
 
Tensor tvm::topi::max (const Tensor &data, const Array< Integer > &axis, bool keepdims=false, bool atleast1d=false)
 Creates an operation that finds the maximum of elements over a given axis. More...
 
FCommReduce tvm::topi::MakeArgminReducer (bool select_last_index=false)
 
Tensor tvm::topi::argmin (const Tensor &data, const Array< Integer > &axis, bool keepdims=false, bool atleast1d=false, bool select_last_index=false)
 Creates an operation that finds the indices of the minimum values over a given axis. More...
 
FCommReduce tvm::topi::MakeArgmaxReducer (bool select_last_index=false)
 
Tensor tvm::topi::argmax (const Tensor &data, const Array< Integer > &axis, bool keepdims=false, bool atleast1d=false, bool select_last_index=false)
 Creates an operation that finds the indices of the maximum values over a given axis. More...
 
Tensor tvm::topi::prod (const Tensor &data, const Array< Integer > &axis, bool keepdims=false, bool atleast1d=false)
 Creates product operation over given axis. More...
 
FCommReduce tvm::topi::MakeTupleSumReducer ()
 Create communitive reducer summing over tuples. More...
 

Detailed Description

Reduction op constructors.