Tenncor
Classes | Namespaces | Macros | Typedefs | Functions
operator.hpp File Reference
#include "eteq/eigen.hpp"
#include "eteq/coord.hpp"
#include "eteq/random.hpp"
Include dependency graph for operator.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  eteq::OpArg< T >
 Raw data, shape, and transformation argument struct. More...
 

Namespaces

 eteq
 
 eteq::internal
 

Macros

#define _ETEQ_INTERNAL_V2A_CASE(N, PROCESS, RED)
 
#define _ETEQ_INTERNAL_V2A(PROCESS, RED)
 

Typedefs

template<typename OP , size_t N, typename T >
using eteq::ReduceOutT = Eigen::TensorReductionOp< OP, const std::array< teq::RankT, N >, const TensMapT< T > >
 Generic Eigen reduction operator. More...
 

Functions

static bool eteq::is_2d (teq::Shape shape)
 
template<size_t N>
std::array< teq::RankT, N > eteq::internal::dim_copy (std::vector< teq::RankT > d)
 Return array of input vector. More...
 
template<typename T >
EigenptrT< T > eteq::reduce_sum (teq::Shape &outshape, const OpArg< T > &in) template< typename T > EigenptrT< T > reduce_prod(teq
 Return Eigen data object representing reduction where aggregation is sum. More...
 
template<typename T >
EigenptrT< T > eteq::permute (teq::Shape &outshape, const OpArg< T > &in)
 Return Eigen data object representing transpose and permutation. More...
 
template<typename T >
EigenptrT< T > eteq::slice (teq::Shape &outshape, const OpArg< T > &in)
 Return Eigen data object representing data slicing of dimensions. More...
 
template<typename T >
EigenptrT< T > eteq::pad (teq::Shape &outshape, const OpArg< T > &in)
 Return Eigen data object representing data zero padding. More...
 
template<typename T >
EigenptrT< T > eteq::stride (teq::Shape &outshape, const OpArg< T > &in)
 Return Eigen data object representing strided view of in. More...
 
template<typename T >
EigenptrT< T > eteq::abs (teq::Shape &outshape, const OpArg< T > &in)
 
template<typename T >
EigenptrT< T > eteq::neg (teq::Shape &outshape, const OpArg< T > &in)
 
template<typename T >
EigenptrT< T > eteq::sin (teq::Shape &outshape, const OpArg< T > &in)
 
template<typename T >
EigenptrT< T > eteq::cos (teq::Shape &outshape, const OpArg< T > &in)
 
template<typename T >
EigenptrT< T > eteq::tan (teq::Shape &outshape, const OpArg< T > &in)
 
template<typename T >
EigenptrT< T > eteq::exp (teq::Shape &outshape, const OpArg< T > &in)
 
template<typename T >
EigenptrT< T > eteq::log (teq::Shape &outshape, const OpArg< T > &in)
 
template<typename T >
EigenptrT< T > eteq::sqrt (teq::Shape &outshape, const OpArg< T > &in)
 
template<typename T >
EigenptrT< T > eteq::round (teq::Shape &outshape, const OpArg< T > &in)
 
template<typename T >
EigenptrT< T > eteq::sigmoid (teq::Shape &outshape, const OpArg< T > &in)
 
template<typename T >
EigenptrT< T > eteq::sigmoid_grad (teq::Shape &outshape, const OpArg< T > &in)
 
template<typename T >
EigenptrT< T > eteq::tanh (teq::Shape &outshape, const OpArg< T > &in)
 
template<typename T >
EigenptrT< T > eteq::square (teq::Shape &outshape, const OpArg< T > &in)
 
template<typename T >
EigenptrT< T > eteq::cube (teq::Shape &outshape, const OpArg< T > &in)
 
template<typename T >
EigenptrT< T > eteq::pow (teq::Shape &outshape, const OpArg< T > &a, const OpArg< T > &b)
 
template<typename T >
EigenptrT< T > eteq::add (teq::Shape &outshape, const OpArg< T > &a, const OpArg< T > &b)
 
template<typename T >
EigenptrT< T > eteq::sub (teq::Shape &outshape, const OpArg< T > &a, const OpArg< T > &b)
 
template<typename T >
EigenptrT< T > eteq::mul (teq::Shape &outshape, const OpArg< T > &a, const OpArg< T > &b)
 
template<typename T >
EigenptrT< T > eteq::div (teq::Shape &outshape, const OpArg< T > &a, const OpArg< T > &b)
 
template<typename T >
EigenptrT< T > eteq::eq (teq::Shape &outshape, const OpArg< T > &a, const OpArg< T > &b)
 
template<typename T >
EigenptrT< T > eteq::neq (teq::Shape &outshape, const OpArg< T > &a, const OpArg< T > &b)
 
template<typename T >
EigenptrT< T > eteq::lt (teq::Shape &outshape, const OpArg< T > &a, const OpArg< T > &b)
 
template<typename T >
EigenptrT< T > eteq::gt (teq::Shape &outshape, const OpArg< T > &a, const OpArg< T > &b)
 
template<typename T >
EigenptrT< T > eteq::min (teq::Shape &outshape, const OpArg< T > &a, const OpArg< T > &b)
 
template<typename T >
EigenptrT< T > eteq::max (teq::Shape &outshape, const OpArg< T > &a, const OpArg< T > &b)
 
template<typename T >
EigenptrT< T > eteq::rand_uniform (teq::Shape &outshape, const OpArg< T > &a, const OpArg< T > &b)
 
template<typename T >
EigenptrT< T > eteq::select (teq::Shape &outshape, const OpArg< T > &condition, const OpArg< T > &then, const OpArg< T > &otherwise)
 
template<typename T >
EigenptrT< T > eteq::matmul (teq::Shape &outshape, const OpArg< T > &a, const OpArg< T > &b)
 
template<typename T >
EigenptrT< T > eteq::convolution (teq::Shape &outshape, const OpArg< T > &input, const OpArg< T > &kernel)
 Apply convolution of kernel across input. More...
 
template<typename T >
EigenptrT< T > eteq::convolution_image_grad (teq::Shape &imageshape, const OpArg< T > &kernel, const OpArg< T > &super_composite)
 Applies the gradient of convolution with respect to image. More...
 
template<typename T >
EigenptrT< T > eteq::convolution_kernel_grad (teq::Shape &kernelshape, const OpArg< T > &image, const OpArg< T > &super_composite)
 Applies the gradient of convolution with respect to kernel. More...
 

Macro Definition Documentation

◆ _ETEQ_INTERNAL_V2A

#define _ETEQ_INTERNAL_V2A (   PROCESS,
  RED 
)
Value:
{\
assert(nullptr != in.coorder_);\
teq::CoordT coord;\
in.coorder_->forward(coord.begin(), coord.begin());\
std::vector<teq::RankT> vdims;\
std::copy_if(coord.begin(), coord.end(), std::back_inserter(vdims),\
[](teq::RankT d) { return d < teq::rank_cap; });\
switch (vdims.size()) {\
_ETEQ_INTERNAL_V2A_CASE(0, PROCESS, RED)\
_ETEQ_INTERNAL_V2A_CASE(1, PROCESS, RED)\
_ETEQ_INTERNAL_V2A_CASE(2, PROCESS, RED)\
_ETEQ_INTERNAL_V2A_CASE(3, PROCESS, RED)\
_ETEQ_INTERNAL_V2A_CASE(4, PROCESS, RED)\
_ETEQ_INTERNAL_V2A_CASE(5, PROCESS, RED)\
_ETEQ_INTERNAL_V2A_CASE(6, PROCESS, RED)\
_ETEQ_INTERNAL_V2A_CASE(7, PROCESS, RED)\
default: break;\
} return make_eigentensor<T,ReduceOutT<RED,8,T>,TensMapT<T>>(\
shape_convert(outshape), [vdims](TensMapT<T>& in) {\
return in.PROCESS(::eteq::internal::dim_copy<8>(vdims));\
}, make_tensmap(in.data_, in.shape_));\
}
std::array< CDimT, rank_cap > CoordT
Definition: shape.hpp:56
const RankT rank_cap
Number of dimsensions in a shape/coordinate.
Definition: shape.hpp:47
TensMapT< T > make_tensmap(T *data, const teq::Shape &shape)
Return Eigen Tensor given raw data and teq Shape.
Definition: eigen.hpp:201
uint8_t RankT
Type used for shape rank.
Definition: shape.hpp:23

◆ _ETEQ_INTERNAL_V2A_CASE

#define _ETEQ_INTERNAL_V2A_CASE (   N,
  PROCESS,
  RED 
)
Value:
case N: return make_eigentensor<T,ReduceOutT<RED,N,T>,TensMapT<T>>(\
shape_convert(outshape), [vdims](TensMapT<T>& in) {\
return in.PROCESS(::eteq::internal::dim_copy<N>(vdims)); },\
make_tensmap(in.data_, in.shape_));