TVM  0.9.4
tvm::utils Namespace Reference

Namespaces

 internal
 

Classes

class  LinearExpr
 
class  AffineExpr
 
class  CheckOptions
 
class  ProtoTaskCommon
 
class  ProtoTaskCommon< constraint::Type::DOUBLE_SIDED, FunT >
 
class  UpdatelessFunction
 

Typedefs

template<constraint::Type T>
using ProtoTask = ProtoTaskCommon< T, FunctionPtr >
 
template<constraint::Type T>
using LinearProtoTask = ProtoTaskCommon< T, LinearFunctionPtr >
 
template<typename T , typename IfNotLinearFunction , typename IfLinearFunction >
using ProtoChoice = typename std::enable_if< std::is_base_of< tvm::function::abstract::Function, T >::value, typename std::conditional< std::is_base_of< tvm::function::abstract::LinearFunction, T >::value, IfLinearFunction, IfNotLinearFunction >::type >::type
 
using ProtoTaskEQ = ProtoTask< constraint::Type::EQUAL >
 
using LinearProtoTaskEQ = LinearProtoTask< constraint::Type::EQUAL >
 
template<typename T >
using ProtoTaskEQRet = ProtoChoice< T, tvm::utils::ProtoTaskEQ, tvm::utils::LinearProtoTaskEQ >
 
using ProtoTaskLT = ProtoTask< constraint::Type::LOWER_THAN >
 
using LinearProtoTaskLT = LinearProtoTask< constraint::Type::LOWER_THAN >
 
template<typename T >
using ProtoTaskLTRet = ProtoChoice< T, tvm::utils::ProtoTaskLT, tvm::utils::LinearProtoTaskLT >
 
using ProtoTaskGT = ProtoTask< constraint::Type::GREATER_THAN >
 
using LinearProtoTaskGT = LinearProtoTask< constraint::Type::GREATER_THAN >
 
template<typename T >
using ProtoTaskGTRet = ProtoChoice< T, tvm::utils::ProtoTaskGT, tvm::utils::LinearProtoTaskGT >
 
using ProtoTaskDS = ProtoTask< constraint::Type::DOUBLE_SIDED >
 
using LinearProtoTaskDS = LinearProtoTask< constraint::Type::DOUBLE_SIDED >
 
template<typename T >
using ProtoTaskDSRet = ProtoChoice< T, tvm::utils::ProtoTaskDS, tvm::utils::LinearProtoTaskDS >
 

Functions

template<unsigned int N>
constexpr unsigned int count_va_args (const char(&s)[N], unsigned int i=0, unsigned int ret=0)
 
template<typename CstDerived , typename... Derived>
AffineExpr< CstDerived, Derived... > make_AffineExpr (const CstDerived &constant, const std::tuple< LinearExpr< Derived >... > &linear)
 
bool TVM_DLLAPI checkJacobian (FunctionPtr f, CheckOptions opt=CheckOptions())
 
template<typename Object , typename... Args>
std::unique_ptr< graph::CallGraphgenerateUpdateGraph (std::shared_ptr< Object > obj, Args &&... args)
 
template<typename Derived >
auto operator- (const tvm::utils::LinearExpr< Derived > &lin)
 
template<typename CstDerived , typename... Derived>
auto operator- (const tvm::utils::AffineExpr< CstDerived, Derived... > &aff)
 
template<typename MultDerived , typename CstDerived , typename... Derived>
auto operator* (const MultDerived &m, const tvm::utils::AffineExpr< CstDerived, Derived... > &aff)
 
template<typename Derived , typename CstDerived >
tvm::utils::AffineExpr< CstDerived, Derived > operator+ (const tvm::utils::LinearExpr< Derived > &lin, const Eigen::MatrixBase< CstDerived > &cst)
 
template<typename Derived , typename CstDerived >
tvm::utils::AffineExpr< CstDerived, Derived > operator+ (const Eigen::MatrixBase< CstDerived > &cst, const tvm::utils::LinearExpr< Derived > &lin)
 
template<typename LhsDerived , typename RhsDerived >
tvm::utils::AffineExpr< tvm::utils::internal::NoConstant, LhsDerived, RhsDerived > operator+ (const tvm::utils::LinearExpr< LhsDerived > &lhs, const tvm::utils::LinearExpr< RhsDerived > &rhs)
 
template<typename RhsDerived , typename CstDerived , typename... LhsDerived>
tvm::utils::AffineExpr< CstDerived, LhsDerived..., RhsDerived > operator+ (const tvm::utils::AffineExpr< CstDerived, LhsDerived... > &lhs, const tvm::utils::LinearExpr< RhsDerived > &rhs)
 
template<typename LhsDerived , typename CstDerived , typename... RhsDerived>
tvm::utils::AffineExpr< CstDerived, LhsDerived, RhsDerived... > operator+ (const tvm::utils::LinearExpr< LhsDerived > &lhs, const tvm::utils::AffineExpr< CstDerived, RhsDerived... > &rhs)
 
template<typename RhsDerived , typename CstDerived , typename... LhsDerived>
tvm::utils::AffineExpr< tvm::utils::internal::AddConstantsRetType< CstDerived, RhsDerived >, LhsDerived... > operator+ (const tvm::utils::AffineExpr< CstDerived, LhsDerived... > &lhs, const Eigen::MatrixBase< RhsDerived > &rhs)
 
template<typename LhsDerived , typename CstDerived , typename... RhsDerived>
tvm::utils::AffineExpr< tvm::utils::internal::AddConstantsRetType< LhsDerived, CstDerived >, RhsDerived... > operator+ (const Eigen::MatrixBase< LhsDerived > &lhs, const tvm::utils::AffineExpr< CstDerived, RhsDerived... > &rhs)
 
template<typename LCstDerived , typename RCstDerived , typename... LhsDerived, typename... RhsDerived>
tvm::utils::AffineExpr< tvm::utils::internal::AddConstantsRetType< LCstDerived, RCstDerived >, LhsDerived..., RhsDerived... > operator+ (const tvm::utils::AffineExpr< LCstDerived, LhsDerived... > &lhs, const tvm::utils::AffineExpr< RCstDerived, RhsDerived... > &rhs)
 
template<typename MultType , typename Derived >
auto operator* (const MultType &m, const tvm::utils::LinearExpr< Derived > &lin)
 
template<typename Derived , typename SubType , typename tvm::internal::enable_for_templated_t< SubType, Eigen::MatrixBase, tvm::utils::LinearExpr, tvm::utils::AffineExpr > = 0>
auto operator- (const tvm::utils::LinearExpr< Derived > &lin, const SubType &rhs)
 
template<typename CstDerived , typename SubType , typename... Derived, typename tvm::internal::enable_for_templated_t< SubType, Eigen::MatrixBase, tvm::utils::LinearExpr, tvm::utils::AffineExpr > = 0>
auto operator- (const tvm::utils::AffineExpr< CstDerived, Derived... > &aff, const SubType &rhs)
 
bool is_malloc_allowed ()
 
bool set_is_malloc_allowed (bool allow)
 
void override_is_malloc_allowed (bool allow)
 
void restore_is_malloc_allowed ()
 
TVM_DLLAPI void transform (sch::S_Object &obj, const sva::PTransformd &t)
 
TVM_DLLAPI std::unique_ptr< sch::S_Polyhedron > Polyhedron (const std::string &filename)
 
TVM_DLLAPI double distance (sch::CD_Pair &pair, Eigen::Vector3d &p1, Eigen::Vector3d &p2)
 

Detailed Description

Copyright 2017-2020 CNRS-AIST JRL and CNRS-UM LIRMM

Typedef Documentation

◆ LinearProtoTask

template<constraint::Type T>
using tvm::utils::LinearProtoTask = typedef ProtoTaskCommon<T, LinearFunctionPtr>

A utility class to represent the "constraint" part of a Task, specialized for linear functions

◆ LinearProtoTaskDS

◆ LinearProtoTaskEQ

◆ LinearProtoTaskGT

◆ LinearProtoTaskLT

◆ ProtoChoice

template<typename T , typename IfNotLinearFunction , typename IfLinearFunction >
using tvm::utils::ProtoChoice = typedef typename std::enable_if<std::is_base_of<tvm::function::abstract::Function, T>::value, typename std::conditional<std::is_base_of<tvm::function::abstract::LinearFunction, T>::value, IfLinearFunction, IfNotLinearFunction>::type>::type

A helper alias that is IfNotLinearFunction if T is a tvm::abstract::Function, but not a tvm::abstract::LinearFunction, IfLinearFunction if it is a tvm::abstract::LinearFunction, and nothing (discarded by SFINAE) otherwise.

◆ ProtoTask

template<constraint::Type T>
using tvm::utils::ProtoTask = typedef ProtoTaskCommon<T, FunctionPtr>

A utility class to represent the "constraint" part of a Task, for general functions

◆ ProtoTaskDS

Double sided inequality ProtoTask l <= f <= u

◆ ProtoTaskDSRet

◆ ProtoTaskEQ

Equality ProtoTask f = rhs

◆ ProtoTaskEQRet

◆ ProtoTaskGT

Inequality ProtoTask f >= rhs

◆ ProtoTaskGTRet

◆ ProtoTaskLT

Inequality ProtoTask f <= rhs

◆ ProtoTaskLTRet

Function Documentation

◆ count_va_args()

template<unsigned int N>
constexpr unsigned int tvm::utils::count_va_args ( const char(&)  s[N],
unsigned int  i = 0,
unsigned int  ret = 0 
)
constexpr

Constexpr function to compute the size of VA_ARGS in a macro.

Does not work if VA_ARGS arguments contains a string with an embedded ',' character. This should not happen in the context we use this function.

Inspired by https://stackoverflow.com/a/35868609

Counts the number of ',' in the stringified version of VA_ARGS

◆ distance()

TVM_DLLAPI double tvm::utils::distance ( sch::CD_Pair &  pair,
Eigen::Vector3d &  p1,
Eigen::Vector3d &  p2 
)

Compute distance between two objects

Parameters
pairpair of SCH objects
p1will be the closest point in the first object
p2will be the closes point in the second object
Returns
The squared distance between the two objects, returns a negative distance in case of inter-penetration

◆ generateUpdateGraph()

template<typename Object , typename... Args>
std::unique_ptr< graph::CallGraph > tvm::utils::generateUpdateGraph ( std::shared_ptr< Object >  obj,
Args &&...  args 
)
inline

Generate the graph of updates for a list of objects and their specified outputs

g = generateUpdateGraph(obj1, o1_1, ..., o1_n1, obj2, o2_1, ..., o2_n2, ..., objk, ok_1, ..., ok_nk) generates a graph g such that g.execute() ensures that outputs o1_1, ... o1_n1 for obj1, o2_1, ... o2_1 for obj2, etc. are up to date.

◆ is_malloc_allowed()

bool tvm::utils::is_malloc_allowed ( )
inline

Return whether dynamic allocation of memory in Eigen objects is allowed or not.

◆ make_AffineExpr()

template<typename CstDerived , typename... Derived>
AffineExpr<CstDerived, Derived...> tvm::utils::make_AffineExpr ( const CstDerived &  constant,
const std::tuple< LinearExpr< Derived >... > &  linear 
)

Helper function to create a AffineExpr and infer automatically the template arguments.

◆ operator*() [1/2]

template<typename MultDerived , typename CstDerived , typename... Derived>
auto tvm::utils::operator* ( const MultDerived &  m,
const tvm::utils::AffineExpr< CstDerived, Derived... > &  aff 
)
inline

Aff = m*Aff, where m is any type accepted by Eigen for pre-multiplication (in particular scalar or matrix expression).

◆ operator*() [2/2]

template<typename MultType , typename Derived >
auto tvm::utils::operator* ( const MultType &  m,
const tvm::utils::LinearExpr< Derived > &  lin 
)
inline

Lin = m * Lin

◆ operator+() [1/8]

template<typename Derived , typename CstDerived >
tvm::utils::AffineExpr<CstDerived, Derived> tvm::utils::operator+ ( const Eigen::MatrixBase< CstDerived > &  cst,
const tvm::utils::LinearExpr< Derived > &  lin 
)
inline

Aff = b + Lin

◆ operator+() [2/8]

template<typename LhsDerived , typename CstDerived , typename... RhsDerived>
tvm::utils::AffineExpr<tvm::utils::internal::AddConstantsRetType<LhsDerived, CstDerived>, RhsDerived...> tvm::utils::operator+ ( const Eigen::MatrixBase< LhsDerived > &  lhs,
const tvm::utils::AffineExpr< CstDerived, RhsDerived... > &  rhs 
)
inline

Aff = b + Aff

◆ operator+() [3/8]

template<typename RhsDerived , typename CstDerived , typename... LhsDerived>
tvm::utils::AffineExpr<tvm::utils::internal::AddConstantsRetType<CstDerived, RhsDerived>, LhsDerived...> tvm::utils::operator+ ( const tvm::utils::AffineExpr< CstDerived, LhsDerived... > &  lhs,
const Eigen::MatrixBase< RhsDerived > &  rhs 
)
inline

Aff = Aff + b

◆ operator+() [4/8]

template<typename RhsDerived , typename CstDerived , typename... LhsDerived>
tvm::utils::AffineExpr<CstDerived, LhsDerived..., RhsDerived> tvm::utils::operator+ ( const tvm::utils::AffineExpr< CstDerived, LhsDerived... > &  lhs,
const tvm::utils::LinearExpr< RhsDerived > &  rhs 
)
inline

Aff = Aff + Lin

◆ operator+() [5/8]

template<typename LCstDerived , typename RCstDerived , typename... LhsDerived, typename... RhsDerived>
tvm::utils:: AffineExpr<tvm::utils::internal::AddConstantsRetType<LCstDerived, RCstDerived>, LhsDerived..., RhsDerived...> tvm::utils::operator+ ( const tvm::utils::AffineExpr< LCstDerived, LhsDerived... > &  lhs,
const tvm::utils::AffineExpr< RCstDerived, RhsDerived... > &  rhs 
)
inline

Aff = Aff + Aff

◆ operator+() [6/8]

template<typename Derived , typename CstDerived >
tvm::utils::AffineExpr<CstDerived, Derived> tvm::utils::operator+ ( const tvm::utils::LinearExpr< Derived > &  lin,
const Eigen::MatrixBase< CstDerived > &  cst 
)
inline

Aff = Lin + b

◆ operator+() [7/8]

template<typename LhsDerived , typename CstDerived , typename... RhsDerived>
tvm::utils::AffineExpr<CstDerived, LhsDerived, RhsDerived...> tvm::utils::operator+ ( const tvm::utils::LinearExpr< LhsDerived > &  lhs,
const tvm::utils::AffineExpr< CstDerived, RhsDerived... > &  rhs 
)
inline

Aff = Lin + Aff

◆ operator+() [8/8]

template<typename LhsDerived , typename RhsDerived >
tvm::utils::AffineExpr<tvm::utils::internal::NoConstant, LhsDerived, RhsDerived> tvm::utils::operator+ ( const tvm::utils::LinearExpr< LhsDerived > &  lhs,
const tvm::utils::LinearExpr< RhsDerived > &  rhs 
)
inline

Aff = Lin + Lin

◆ operator-() [1/4]

template<typename CstDerived , typename... Derived>
auto tvm::utils::operator- ( const tvm::utils::AffineExpr< CstDerived, Derived... > &  aff)
inline

Aff = -Aff

◆ operator-() [2/4]

template<typename CstDerived , typename SubType , typename... Derived, typename tvm::internal::enable_for_templated_t< SubType, Eigen::MatrixBase, tvm::utils::LinearExpr, tvm::utils::AffineExpr > = 0>
auto tvm::utils::operator- ( const tvm::utils::AffineExpr< CstDerived, Derived... > &  aff,
const SubType &  rhs 
)
inline

Aff = Aff - a

◆ operator-() [3/4]

template<typename Derived >
auto tvm::utils::operator- ( const tvm::utils::LinearExpr< Derived > &  lin)
inline

Lin = -Lin

◆ operator-() [4/4]

template<typename Derived , typename SubType , typename tvm::internal::enable_for_templated_t< SubType, Eigen::MatrixBase, tvm::utils::LinearExpr, tvm::utils::AffineExpr > = 0>
auto tvm::utils::operator- ( const tvm::utils::LinearExpr< Derived > &  lin,
const SubType &  rhs 
)
inline

Aff = Lin - a

◆ override_is_malloc_allowed()

void tvm::utils::override_is_malloc_allowed ( bool  allow)
inline

Record whether dynamic allocation of memory in Eigen objects is allowed or not and set allow instead. Records are made with a stack.

Any call to this function should be mirrored by a call to restore_is_malloc_allowed(). It is advised to call restore_is_malloc_allowed() in the same scope.

◆ Polyhedron()

TVM_DLLAPI std::unique_ptr<sch::S_Polyhedron> tvm::utils::Polyhedron ( const std::string &  filename)

Loads an sch::S_Polyhedron object using filename

◆ restore_is_malloc_allowed()

void tvm::utils::restore_is_malloc_allowed ( )
inline

Restore the latest value recorded by override_is_malloc_allowed that was not already restored.

◆ set_is_malloc_allowed()

bool tvm::utils::set_is_malloc_allowed ( bool  allow)
inline

Set whether dynamic allocation of memory in Eigen objects is allowed or not.

◆ transform()

TVM_DLLAPI void tvm::utils::transform ( sch::S_Object &  obj,
const sva::PTransformd &  t 
)

Set obj pose to t