Logo ROOT  
Reference Guide
TMVA::DNN::TCpuTensor< AFloat > Class Template Reference

template<typename AFloat>
class TMVA::DNN::TCpuTensor< AFloat >

Definition at line 40 of file CpuTensor.h.

Public Types

using Matrix_t = TCpuMatrix< AFloat >
 
using MemoryLayout = TMVA::Experimental::MemoryLayout
 
using Scalar_t = AFloat
 
using Shape_t = typename TMVA::Experimental::RTensor< AFloat >::Shape_t
 
- Public Types inherited from TMVA::Experimental::RTensor< AFloat, TCpuBuffer< AFloat > >
using Container_t = TCpuBuffer< AFloat >
 
using Index_t = Shape_t
 
using Shape_t = std::vector< std::size_t >
 
using Slice_t = std::vector< Shape_t >
 
using Value_t = AFloat
 

Public Member Functions

 TCpuTensor ()
 
 TCpuTensor (AFloat *data, const Shape_t &shape, MemoryLayout memlayout=MemoryLayout::ColumnMajor)
 
 TCpuTensor (const TCpuBuffer< AFloat > &buffer, Shape_t shape, MemoryLayout memlayout=MemoryLayout::ColumnMajor)
 constructors from a TCpuBuffer and a shape More...
 
 TCpuTensor (const TCpuMatrix< AFloat > &matrix, size_t dim=3, MemoryLayout memlayout=MemoryLayout::ColumnMajor)
 constructors from a TCpuMatrix. More...
 
 TCpuTensor (Shape_t shape, MemoryLayout memlayout=MemoryLayout::ColumnMajor)
 constructors from a shape. More...
 
 TCpuTensor (size_t bsize, size_t depth, size_t height, size_t width, MemoryLayout memlayout=MemoryLayout::ColumnMajor)
 constructors from batch size, depth, height, width More...
 
 TCpuTensor (size_t bsize, size_t depth, size_t hw, MemoryLayout memlayout=MemoryLayout::ColumnMajor)
 constructors from batch size, depth, height*width More...
 
 TCpuTensor (size_t n, size_t m, MemoryLayout memlayout=MemoryLayout::ColumnMajor)
 constructors from n m More...
 
TCpuTensor< AFloat > At (size_t i)
 
TCpuTensor< AFloat > At (size_t i) const
 
size_t GetBufferUseCount () const
 
size_t GetCSize () const
 
TCpuBuffer< AFloat > & GetDeviceBuffer ()
 
const TCpuBuffer< AFloat > & GetDeviceBuffer () const
 
size_t GetFirstSize () const
 
size_t GetHSize () const
 
MemoryLayout GetLayout () const
 
TCpuMatrix< AFloat > GetMatrix () const
 
size_t GetNcols () const
 
size_t GetNoElements () const
 
size_t GetNrows () const
 
AFloat * GetRawDataPointer ()
 Return raw pointer to the elements stored contiguously in column-major order. More...
 
const AFloat * GetRawDataPointer () const
 
size_t GetWSize () const
 
template<typename Function_t >
void Map (Function_t &f)
 Map the given function over the matrix elements. More...
 
template<typename Function_t >
void MapFrom (Function_t &f, const TCpuTensor< AFloat > &A)
 Same as maps but takes the input values from the tensor A and writes the results in this tensor. More...
 
 operator TMatrixT< AFloat > () const
 Convert to a TMatrixT<AFloat_t> object. More...
 
AFloat & operator() (size_t i, size_t j)
 
AFloat operator() (size_t i, size_t j) const
 
AFloat & operator() (size_t i, size_t j, size_t k)
 
AFloat operator() (size_t i, size_t j, size_t k) const
 
TCpuMatrix< AFloat > operator[] (size_t i) const
 
void Print (const char *name="Tensor") const
 
void PrintShape (const char *name="Tensor") const
 
TCpuTensor< AFloat > Reshape (Shape_t shape) const
 
void Zero ()
 
- Public Member Functions inherited from TMVA::Experimental::RTensor< AFloat, TCpuBuffer< AFloat > >
 RTensor (Shape_t shape, MemoryLayout layout=MemoryLayout::RowMajor)
 Construct a tensor owning data initialized with new container. More...
 
 RTensor (std::shared_ptr< Container_t > container, Shape_t shape, MemoryLayout layout=MemoryLayout::RowMajor)
 Construct a tensor owning externally provided data. More...
 
 RTensor (Value_t *data, Shape_t shape, MemoryLayout layout=MemoryLayout::RowMajor)
 Construct a tensor as view on data. More...
 
 RTensor (Value_t *data, Shape_t shape, Shape_t strides, MemoryLayout layout=MemoryLayout::RowMajor)
 Construct a tensor as view on data. More...
 
Iterator begin () noexcept
 
RTensor< Value_t, Container_tCopy (MemoryLayout layout=MemoryLayout::RowMajor)
 Copy RTensor to new object. More...
 
Iterator end () noexcept
 
RTensor< Value_t, Container_tExpandDims (int idx)
 Expand dimensions. More...
 
std::shared_ptr< Container_tGetContainer ()
 
const std::shared_ptr< Container_tGetContainer () const
 
Value_tGetData ()
 
const Value_tGetData () const
 
MemoryLayout GetMemoryLayout () const
 
const Shape_tGetShape () const
 
std::size_t GetSize () const
 
const Shape_tGetStrides () const
 
bool IsOwner () const
 
bool IsView () const
 
Value_toperator() (const Index_t &idx)
 Access elements. More...
 
const Value_toperator() (const Index_t &idx) const
 Access elements. More...
 
Value_toperator() (Idx... idx)
 Access elements. More...
 
const Value_toperator() (Idx... idx) const
 Access elements. More...
 
RTensor< Value_t, Container_tReshape (const Shape_t &shape)
 Reshape tensor. More...
 
RTensor< Value_t, Container_tSlice (const Slice_t &slice)
 Create a slice of the tensor. More...
 
RTensor< Value_t, Container_tSqueeze ()
 Squeeze dimensions. More...
 
RTensor< Value_t, Container_tTranspose ()
 Transpose. More...
 

Friends

class TCpuMatrix< AFloat >
 

Additional Inherited Members

- Protected Member Functions inherited from TMVA::Experimental::RTensor< AFloat, TCpuBuffer< AFloat > >
void ReshapeInplace (const Shape_t &shape)
 Reshape tensor in place. More...
 

#include <TMVA/DNN/Architectures/Cpu/CpuTensor.h>

Inheritance diagram for TMVA::DNN::TCpuTensor< AFloat >:
[legend]

Member Typedef Documentation

◆ Matrix_t

template<typename AFloat >
using TMVA::DNN::TCpuTensor< AFloat >::Matrix_t = TCpuMatrix<AFloat>

Definition at line 49 of file CpuTensor.h.

◆ MemoryLayout

template<typename AFloat >
using TMVA::DNN::TCpuTensor< AFloat >::MemoryLayout = TMVA::Experimental::MemoryLayout

Definition at line 48 of file CpuTensor.h.

◆ Scalar_t

template<typename AFloat >
using TMVA::DNN::TCpuTensor< AFloat >::Scalar_t = AFloat

Definition at line 50 of file CpuTensor.h.

◆ Shape_t

template<typename AFloat >
using TMVA::DNN::TCpuTensor< AFloat >::Shape_t = typename TMVA::Experimental::RTensor<AFloat>::Shape_t

Definition at line 47 of file CpuTensor.h.

Constructor & Destructor Documentation

◆ TCpuTensor() [1/8]

template<typename AFloat >
TMVA::DNN::TCpuTensor< AFloat >::TCpuTensor ( )
inline

Definition at line 53 of file CpuTensor.h.

◆ TCpuTensor() [2/8]

template<typename AFloat >
TMVA::DNN::TCpuTensor< AFloat >::TCpuTensor ( size_t  n,
size_t  m,
MemoryLayout  memlayout = MemoryLayout::ColumnMajor 
)
inline

constructors from n m

Definition at line 57 of file CpuTensor.h.

◆ TCpuTensor() [3/8]

template<typename AFloat >
TMVA::DNN::TCpuTensor< AFloat >::TCpuTensor ( size_t  bsize,
size_t  depth,
size_t  hw,
MemoryLayout  memlayout = MemoryLayout::ColumnMajor 
)
inline

constructors from batch size, depth, height*width

Definition at line 62 of file CpuTensor.h.

◆ TCpuTensor() [4/8]

template<typename AFloat >
TMVA::DNN::TCpuTensor< AFloat >::TCpuTensor ( size_t  bsize,
size_t  depth,
size_t  height,
size_t  width,
MemoryLayout  memlayout = MemoryLayout::ColumnMajor 
)
inline

constructors from batch size, depth, height, width

Definition at line 70 of file CpuTensor.h.

◆ TCpuTensor() [5/8]

template<typename AFloat >
TMVA::DNN::TCpuTensor< AFloat >::TCpuTensor ( Shape_t  shape,
MemoryLayout  memlayout = MemoryLayout::ColumnMajor 
)
inline

constructors from a shape.

Definition at line 80 of file CpuTensor.h.

◆ TCpuTensor() [6/8]

template<typename AFloat >
TMVA::DNN::TCpuTensor< AFloat >::TCpuTensor ( AFloat *  data,
const Shape_t shape,
MemoryLayout  memlayout = MemoryLayout::ColumnMajor 
)
inline

Definition at line 87 of file CpuTensor.h.

◆ TCpuTensor() [7/8]

template<typename AFloat >
TMVA::DNN::TCpuTensor< AFloat >::TCpuTensor ( const TCpuBuffer< AFloat > &  buffer,
Shape_t  shape,
MemoryLayout  memlayout = MemoryLayout::ColumnMajor 
)
inline

constructors from a TCpuBuffer and a shape

Definition at line 99 of file CpuTensor.h.

◆ TCpuTensor() [8/8]

template<typename AFloat >
TMVA::DNN::TCpuTensor< AFloat >::TCpuTensor ( const TCpuMatrix< AFloat > &  matrix,
size_t  dim = 3,
MemoryLayout  memlayout = MemoryLayout::ColumnMajor 
)
inline

constructors from a TCpuMatrix.

Memory layout is forced to be same as matrix (i.e. columnlayout)

Definition at line 108 of file CpuTensor.h.

Member Function Documentation

◆ At() [1/2]

template<typename AFloat >
TCpuTensor<AFloat> TMVA::DNN::TCpuTensor< AFloat >::At ( size_t  i)
inline

Definition at line 221 of file CpuTensor.h.

◆ At() [2/2]

template<typename AFloat >
TCpuTensor<AFloat> TMVA::DNN::TCpuTensor< AFloat >::At ( size_t  i) const
inline

Definition at line 234 of file CpuTensor.h.

◆ GetBufferUseCount()

template<typename AFloat >
size_t TMVA::DNN::TCpuTensor< AFloat >::GetBufferUseCount ( ) const
inline

Definition at line 300 of file CpuTensor.h.

◆ GetCSize()

template<typename AFloat >
size_t TMVA::DNN::TCpuTensor< AFloat >::GetCSize ( ) const
inline

Definition at line 161 of file CpuTensor.h.

◆ GetDeviceBuffer() [1/2]

template<typename AFloat >
TCpuBuffer<AFloat>& TMVA::DNN::TCpuTensor< AFloat >::GetDeviceBuffer ( )
inline

Definition at line 146 of file CpuTensor.h.

◆ GetDeviceBuffer() [2/2]

template<typename AFloat >
const TCpuBuffer<AFloat>& TMVA::DNN::TCpuTensor< AFloat >::GetDeviceBuffer ( ) const
inline

Definition at line 145 of file CpuTensor.h.

◆ GetFirstSize()

template<typename AFloat >
size_t TMVA::DNN::TCpuTensor< AFloat >::GetFirstSize ( ) const
inline

Definition at line 155 of file CpuTensor.h.

◆ GetHSize()

template<typename AFloat >
size_t TMVA::DNN::TCpuTensor< AFloat >::GetHSize ( ) const
inline

Definition at line 168 of file CpuTensor.h.

◆ GetLayout()

template<typename AFloat >
MemoryLayout TMVA::DNN::TCpuTensor< AFloat >::GetLayout ( ) const
inline

Definition at line 194 of file CpuTensor.h.

◆ GetMatrix()

template<typename AFloat >
TCpuMatrix<AFloat> TMVA::DNN::TCpuTensor< AFloat >::GetMatrix ( ) const
inline

Definition at line 197 of file CpuTensor.h.

◆ GetNcols()

template<typename AFloat >
size_t TMVA::DNN::TCpuTensor< AFloat >::GetNcols ( ) const
inline

Definition at line 191 of file CpuTensor.h.

◆ GetNoElements()

template<typename AFloat >
size_t TMVA::DNN::TCpuTensor< AFloat >::GetNoElements ( ) const
inline

Definition at line 149 of file CpuTensor.h.

◆ GetNrows()

template<typename AFloat >
size_t TMVA::DNN::TCpuTensor< AFloat >::GetNrows ( ) const
inline

Definition at line 190 of file CpuTensor.h.

◆ GetRawDataPointer() [1/2]

template<typename AFloat >
AFloat* TMVA::DNN::TCpuTensor< AFloat >::GetRawDataPointer ( )
inline

Return raw pointer to the elements stored contiguously in column-major order.

Definition at line 141 of file CpuTensor.h.

◆ GetRawDataPointer() [2/2]

template<typename AFloat >
const AFloat* TMVA::DNN::TCpuTensor< AFloat >::GetRawDataPointer ( ) const
inline

Definition at line 142 of file CpuTensor.h.

◆ GetWSize()

template<typename AFloat >
size_t TMVA::DNN::TCpuTensor< AFloat >::GetWSize ( ) const
inline

Definition at line 177 of file CpuTensor.h.

◆ Map()

template<typename AFloat >
template<typename Function_t >
void TMVA::DNN::TCpuTensor< AFloat >::Map ( Function_t &  f)
inline

Map the given function over the matrix elements.

Executed in parallel using TThreadExecutor.

Definition at line 325 of file CpuTensor.h.

◆ MapFrom()

template<typename AFloat >
template<typename Function_t >
void TMVA::DNN::TCpuTensor< AFloat >::MapFrom ( Function_t &  f,
const TCpuTensor< AFloat > &  A 
)
inline

Same as maps but takes the input values from the tensor A and writes the results in this tensor.

Definition at line 354 of file CpuTensor.h.

◆ operator TMatrixT< AFloat >()

template<typename AFloat >
TMVA::DNN::TCpuTensor< AFloat >::operator TMatrixT< AFloat > ( ) const
inline

Convert to a TMatrixT<AFloat_t> object.

Performs a deep copy of the matrix elements.

Definition at line 128 of file CpuTensor.h.

◆ operator()() [1/4]

template<typename AFloat >
AFloat& TMVA::DNN::TCpuTensor< AFloat >::operator() ( size_t  i,
size_t  j 
)
inline

Definition at line 251 of file CpuTensor.h.

◆ operator()() [2/4]

template<typename AFloat >
AFloat TMVA::DNN::TCpuTensor< AFloat >::operator() ( size_t  i,
size_t  j 
) const
inline

Definition at line 272 of file CpuTensor.h.

◆ operator()() [3/4]

template<typename AFloat >
AFloat& TMVA::DNN::TCpuTensor< AFloat >::operator() ( size_t  i,
size_t  j,
size_t  k 
)
inline

Definition at line 261 of file CpuTensor.h.

◆ operator()() [4/4]

template<typename AFloat >
AFloat TMVA::DNN::TCpuTensor< AFloat >::operator() ( size_t  i,
size_t  j,
size_t  k 
) const
inline

Definition at line 280 of file CpuTensor.h.

◆ operator[]()

template<typename AFloat >
TCpuMatrix<AFloat> TMVA::DNN::TCpuTensor< AFloat >::operator[] ( size_t  i) const
inline

Definition at line 237 of file CpuTensor.h.

◆ Print()

template<typename AFloat >
void TMVA::DNN::TCpuTensor< AFloat >::Print ( const char *  name = "Tensor") const
inline

Definition at line 302 of file CpuTensor.h.

◆ PrintShape()

template<typename AFloat >
void TMVA::DNN::TCpuTensor< AFloat >::PrintShape ( const char *  name = "Tensor") const
inline

Definition at line 310 of file CpuTensor.h.

◆ Reshape()

template<typename AFloat >
TCpuTensor<AFloat> TMVA::DNN::TCpuTensor< AFloat >::Reshape ( Shape_t  shape) const
inline

Definition at line 212 of file CpuTensor.h.

◆ Zero()

template<typename AFloat >
void TMVA::DNN::TCpuTensor< AFloat >::Zero ( )
inline

Definition at line 243 of file CpuTensor.h.

Friends And Related Function Documentation

◆ TCpuMatrix< AFloat >

template<typename AFloat >
friend class TCpuMatrix< AFloat >
friend

Definition at line 354 of file CpuTensor.h.


The documentation for this class was generated from the following file: