Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TMVA::Experimental::SOFIE::UTILITY Namespace Reference

Functions

bool AreSameShape (const std::vector< size_t > &, const std::vector< size_t > &)
 
template<typename T >
T * BroadcastConvBias (const T *data, const size_t channel, const std::vector< size_t > &targetShape)
 
template<typename T >
T * BroadcastTensor (const T *data, const std::vector< size_t > &shape, const std::vector< size_t > &targetShape)
 
std::string Clean_name (std::string input_tensor_name)
 
template<typename Dtype >
void col2im (const Dtype *data_col, const int channels, const int height, const int width, const int kernel_h, const int kernel_w, const int pad_h, const int pad_w, const int stride_h, const int stride_w, const int dilation_h, const int dilation_w, Dtype *data_im)
 
std::vector< size_t > ComputeStrideFromShape (const std::vector< size_t > &shape)
 compute stride of a tensor given its shape (assume layout is row-major)
 
template<typename T >
void Im2col (const T *data_im, const int channels, const int height, const int width, const int kernel_h, const int kernel_w, const int pad_h, const int pad_w, const int stride_h, const int stride_w, const int dilation_h, const int dilation_w, T *data_col)
 im2col : efficient function to re-arrange input data of convolution to a matrix that can be used by BLAS Use trick to loop on each element of filtered region first and follow input data layout By doing this reads and writes are of consecutive data in memory and one gains in efficiency The resulting matrix will be already transposed and can be used directly in BLAS since output will be a matrix : (channels*kernel_h*kernel_w , output_h*output_w) Example: with an input matrix a1 a2 a3 b1 b2 b3 and a 2x2 kernel (k1,k2,k3,k4) and padding 1 : c1 c2 c3 outpout will be a matrix (4 x 16) the routine will follow output order :
 
template<typename T >
void Im2col_3d (const T *data_im, const int channels, const int depth, const int height, const int width, const int kernel_d, const int kernel_h, const int kernel_w, const int pad_d, const int pad_h, const int pad_w, const int stride_d, const int stride_h, const int stride_w, const int dilation_d, const int dilation_h, const int dilation_w, T *data_col)
 3d implementation
 
bool is_a_ge_zero_and_a_lt_b (int a, int b)
 function to check if a >> 0 and a < MAX using a single comparison / use trick casting to unsigned values so it becomes a single comparison
 
std::vector< size_t > MultidirectionalBroadcastShape (std::vector< std::vector< size_t > >)
 
template<typename T >
T * UnidirectionalBroadcast (const T *data, const std::vector< size_t > &shape, const std::vector< size_t > &targetShape)
 
std::vector< size_t > UnidirectionalBroadcastShape (std::vector< size_t >, std::vector< size_t >)
 

Function Documentation

◆ AreSameShape()

bool TMVA::Experimental::SOFIE::UTILITY::AreSameShape ( const std::vector< size_t > &  shapeA,
const std::vector< size_t > &  shapeB 
)

Definition at line 100 of file SOFIE_common.cxx.

◆ BroadcastConvBias()

template<typename T >
T * TMVA::Experimental::SOFIE::UTILITY::BroadcastConvBias ( const T *  data,
const size_t  channel,
const std::vector< size_t > &  targetShape 
)

Definition at line 142 of file SOFIE_common.hxx.

◆ BroadcastTensor()

template<typename T >
T * TMVA::Experimental::SOFIE::UTILITY::BroadcastTensor ( const T *  data,
const std::vector< size_t > &  shape,
const std::vector< size_t > &  targetShape 
)

Definition at line 184 of file SOFIE_common.hxx.

◆ Clean_name()

std::string TMVA::Experimental::SOFIE::UTILITY::Clean_name ( std::string  input_tensor_name)

Definition at line 282 of file SOFIE_common.cxx.

◆ col2im()

template<typename Dtype >
void TMVA::Experimental::SOFIE::UTILITY::col2im ( const Dtype *  data_col,
const int  channels,
const int  height,
const int  width,
const int  kernel_h,
const int  kernel_w,
const int  pad_h,
const int  pad_w,
const int  stride_h,
const int  stride_w,
const int  dilation_h,
const int  dilation_w,
Dtype *  data_im 
)

Definition at line 369 of file SOFIE_common.hxx.

◆ ComputeStrideFromShape()

std::vector< size_t > TMVA::Experimental::SOFIE::UTILITY::ComputeStrideFromShape ( const std::vector< size_t > &  shape)

compute stride of a tensor given its shape (assume layout is row-major)

Definition at line 288 of file SOFIE_common.cxx.

◆ Im2col()

template<typename T >
void TMVA::Experimental::SOFIE::UTILITY::Im2col ( const T *  data_im,
const int  channels,
const int  height,
const int  width,
const int  kernel_h,
const int  kernel_w,
const int  pad_h,
const int  pad_w,
const int  stride_h,
const int  stride_w,
const int  dilation_h,
const int  dilation_w,
T *  data_col 
)

im2col : efficient function to re-arrange input data of convolution to a matrix that can be used by BLAS Use trick to loop on each element of filtered region first and follow input data layout By doing this reads and writes are of consecutive data in memory and one gains in efficiency The resulting matrix will be already transposed and can be used directly in BLAS since output will be a matrix : (channels*kernel_h*kernel_w , output_h*output_w) Example: with an input matrix a1 a2 a3 b1 b2 b3 and a 2x2 kernel (k1,k2,k3,k4) and padding 1 : c1 c2 c3 outpout will be a matrix (4 x 16) the routine will follow output order :

-> ( 0 0 0 0 0 a1 a2 a3 0 b1 b2 b3 0 c1 c2 c3 ) all elements for k1 ( 0 0 0 0 a1 a2 a3 0 b1 b2 b3 0 c1 c2 c3 0 ) for k2 ( 0 a1 a2 a3 0 b1 b2 b3 0 c1 c2 c3 0 0 0 0 ) for k3 ( a1 a2 a3 0 b1 b2 b3 0 c1 c2 c3 0 0 0 0 0 ) for k4

Definition at line 279 of file SOFIE_common.hxx.

◆ Im2col_3d()

template<typename T >
void TMVA::Experimental::SOFIE::UTILITY::Im2col_3d ( const T *  data_im,
const int  channels,
const int  depth,
const int  height,
const int  width,
const int  kernel_d,
const int  kernel_h,
const int  kernel_w,
const int  pad_d,
const int  pad_h,
const int  pad_w,
const int  stride_d,
const int  stride_h,
const int  stride_w,
const int  dilation_d,
const int  dilation_h,
const int  dilation_w,
T *  data_col 
)

3d implementation

Definition at line 315 of file SOFIE_common.hxx.

◆ is_a_ge_zero_and_a_lt_b()

bool TMVA::Experimental::SOFIE::UTILITY::is_a_ge_zero_and_a_lt_b ( int  a,
int  b 
)
inline

function to check if a >> 0 and a < MAX using a single comparison / use trick casting to unsigned values so it becomes a single comparison

Definition at line 254 of file SOFIE_common.hxx.

◆ MultidirectionalBroadcastShape()

std::vector< size_t > TMVA::Experimental::SOFIE::UTILITY::MultidirectionalBroadcastShape ( std::vector< std::vector< size_t > >  shape)

Definition at line 112 of file SOFIE_common.cxx.

◆ UnidirectionalBroadcast()

template<typename T >
T * TMVA::Experimental::SOFIE::UTILITY::UnidirectionalBroadcast ( const T *  data,
const std::vector< size_t > &  shape,
const std::vector< size_t > &  targetShape 
)

Definition at line 237 of file SOFIE_common.hxx.

◆ UnidirectionalBroadcastShape()

std::vector< size_t > TMVA::Experimental::SOFIE::UTILITY::UnidirectionalBroadcastShape ( std::vector< size_t >  shapeA,
std::vector< size_t >  shapeB 
)

Definition at line 238 of file SOFIE_common.cxx.