Definition at line 50 of file CpuTensor.h.
Public Types | |
| using | Matrix_t = TCpuMatrix<AFloat> |
| using | MemoryLayout = TMVA::DNN::MemoryLayout |
| using | Scalar_t = AFloat |
| using | Shape_t = std::vector<std::size_t> |
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 | |
| TCpuTensor (const TCpuMatrix< AFloat > &matrix, size_t dim=3, MemoryLayout memlayout=MemoryLayout::ColumnMajor) | |
| constructors from a TCpuMatrix. | |
| TCpuTensor (Shape_t shape, MemoryLayout memlayout=MemoryLayout::ColumnMajor) | |
| constructors from a shape. | |
| TCpuTensor (size_t bsize, size_t depth, size_t height, size_t width, MemoryLayout memlayout=MemoryLayout::ColumnMajor) | |
| constructors from batch size, depth, height, width | |
| TCpuTensor (size_t bsize, size_t depth, size_t hw, MemoryLayout memlayout=MemoryLayout::ColumnMajor) | |
| constructors from batch size, depth, height*width | |
| TCpuTensor (size_t n, size_t m, MemoryLayout memlayout=MemoryLayout::ColumnMajor) | |
| constructors from n m | |
| TCpuTensor (std::shared_ptr< TCpuBuffer< AFloat > > container, Shape_t shape, MemoryLayout layout) | |
| Construct a tensor sharing the given buffer. | |
| TCpuTensor< AFloat > | At (size_t i) |
| TCpuTensor< AFloat > | At (size_t i) const |
| size_t | GetBufferUseCount () const |
| std::shared_ptr< TCpuBuffer< AFloat > > | GetContainer () |
| const std::shared_ptr< TCpuBuffer< AFloat > > | GetContainer () const |
| size_t | GetCSize () const |
| AFloat * | GetData () |
| const AFloat * | GetData () const |
| TCpuBuffer< AFloat > & | GetDeviceBuffer () |
| const TCpuBuffer< AFloat > & | GetDeviceBuffer () const |
| size_t | GetFirstSize () const |
| size_t | GetHSize () const |
| MemoryLayout | GetLayout () const |
| TCpuMatrix< AFloat > | GetMatrix () const |
| MemoryLayout | GetMemoryLayout () 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. | |
| const AFloat * | GetRawDataPointer () const |
| const Shape_t & | GetShape () const |
| std::size_t | GetSize () const |
| const Shape_t & | GetStrides () const |
| size_t | GetWSize () const |
| template<typename Function_t > | |
| void | Map (Function_t &f) |
| Map the given function over the matrix elements. | |
| 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. | |
| operator TMatrixT< AFloat > () const | |
| Convert to a TMatrixT<AFloat_t> object. | |
| 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 | ReshapeInplace (const Shape_t &shape) |
| Reshape tensor in place. | |
| void | Zero () |
Static Private Member Functions | |
| static Shape_t | ComputeStridesFromShape (const Shape_t &shape, MemoryLayout layout) |
| Compute strides from a shape vector. | |
| static std::size_t | GetSizeFromShape (const Shape_t &shape) |
| Compute the total number of elements from a shape vector. | |
Private Attributes | |
| std::shared_ptr< TCpuBuffer< AFloat > > | fContainer |
| Buffer owning the data. | |
| AFloat * | fData = nullptr |
| Pointer to the first element. | |
| MemoryLayout | fLayout |
| Memory layout of the tensor. | |
| Shape_t | fShape |
| Shape of the tensor. | |
| std::size_t | fSize |
| Total number of elements. | |
| Shape_t | fStrides |
| Strides of the tensor. | |
Friends | |
| class | TCpuMatrix< AFloat > |
#include <TMVA/DNN/Architectures/Cpu/CpuTensor.h>
| using TMVA::DNN::TCpuTensor< AFloat >::Matrix_t = TCpuMatrix<AFloat> |
Definition at line 57 of file CpuTensor.h.
| using TMVA::DNN::TCpuTensor< AFloat >::MemoryLayout = TMVA::DNN::MemoryLayout |
Definition at line 56 of file CpuTensor.h.
| using TMVA::DNN::TCpuTensor< AFloat >::Scalar_t = AFloat |
Definition at line 58 of file CpuTensor.h.
| using TMVA::DNN::TCpuTensor< AFloat >::Shape_t = std::vector<std::size_t> |
Definition at line 55 of file CpuTensor.h.
|
inline |
Construct a tensor sharing the given buffer.
The container holds the memory and its destructor releases it when all tensors sharing it are destroyed.
Definition at line 112 of file CpuTensor.h.
|
inline |
Definition at line 121 of file CpuTensor.h.
|
inline |
constructors from n m
Definition at line 124 of file CpuTensor.h.
|
inline |
constructors from batch size, depth, height*width
Definition at line 129 of file CpuTensor.h.
|
inline |
constructors from batch size, depth, height, width
Definition at line 137 of file CpuTensor.h.
|
inline |
constructors from a shape.
Definition at line 147 of file CpuTensor.h.
|
inline |
Definition at line 153 of file CpuTensor.h.
|
inline |
constructors from a TCpuBuffer and a shape
Definition at line 164 of file CpuTensor.h.
|
inline |
constructors from a TCpuMatrix.
Memory layout is forced to be same as matrix (i.e. columnlayout)
Definition at line 172 of file CpuTensor.h.
|
inline |
Definition at line 318 of file CpuTensor.h.
|
inline |
Definition at line 331 of file CpuTensor.h.
|
inlinestaticprivate |
Compute strides from a shape vector.
This information is needed for the multi-dimensional indexing: for row-major layout the last dimension varies fastest, while for column-major layout the first dimension varies fastest.
Definition at line 84 of file CpuTensor.h.
|
inline |
Definition at line 397 of file CpuTensor.h.
|
inline |
Definition at line 209 of file CpuTensor.h.
|
inline |
Definition at line 210 of file CpuTensor.h.
|
inline |
Definition at line 258 of file CpuTensor.h.
|
inline |
Definition at line 207 of file CpuTensor.h.
|
inline |
Definition at line 208 of file CpuTensor.h.
|
inline |
Definition at line 243 of file CpuTensor.h.
|
inline |
Definition at line 242 of file CpuTensor.h.
|
inline |
Definition at line 252 of file CpuTensor.h.
|
inline |
Definition at line 265 of file CpuTensor.h.
|
inline |
Definition at line 291 of file CpuTensor.h.
|
inline |
Definition at line 294 of file CpuTensor.h.
|
inline |
Definition at line 211 of file CpuTensor.h.
|
inline |
Definition at line 288 of file CpuTensor.h.
|
inline |
Definition at line 246 of file CpuTensor.h.
|
inline |
Definition at line 287 of file CpuTensor.h.
|
inline |
Return raw pointer to the elements stored contiguously in column-major order.
Definition at line 238 of file CpuTensor.h.
|
inline |
Definition at line 239 of file CpuTensor.h.
|
inline |
Definition at line 205 of file CpuTensor.h.
|
inline |
Definition at line 204 of file CpuTensor.h.
|
inlinestaticprivate |
Compute the total number of elements from a shape vector.
An empty shape has size 0.
Definition at line 70 of file CpuTensor.h.
|
inline |
Definition at line 206 of file CpuTensor.h.
|
inline |
Definition at line 274 of file CpuTensor.h.
|
inline |
Map the given function over the matrix elements.
Executed in parallel using TThreadExecutor.
Definition at line 422 of file CpuTensor.h.
|
inline |
Same as maps but takes the input values from the tensor A and writes the results in this tensor.
Definition at line 451 of file CpuTensor.h.
|
inline |
Convert to a TMatrixT<AFloat_t> object.
Performs a deep copy of the matrix elements.
Definition at line 193 of file CpuTensor.h.
|
inline |
Definition at line 348 of file CpuTensor.h.
|
inline |
Definition at line 369 of file CpuTensor.h.
|
inline |
Definition at line 358 of file CpuTensor.h.
|
inline |
Definition at line 377 of file CpuTensor.h.
|
inline |
Definition at line 334 of file CpuTensor.h.
|
inline |
Definition at line 399 of file CpuTensor.h.
|
inline |
Definition at line 407 of file CpuTensor.h.
|
inline |
Definition at line 309 of file CpuTensor.h.
|
inline |
Reshape tensor in place.
The new shape must have the same overall size as the old one.
Definition at line 215 of file CpuTensor.h.
|
inline |
Definition at line 340 of file CpuTensor.h.
|
friend |
Definition at line 451 of file CpuTensor.h.
|
private |
Buffer owning the data.
Definition at line 66 of file CpuTensor.h.
|
private |
Pointer to the first element.
Definition at line 65 of file CpuTensor.h.
|
private |
Memory layout of the tensor.
Definition at line 64 of file CpuTensor.h.
|
private |
Shape of the tensor.
Definition at line 61 of file CpuTensor.h.
|
private |
Total number of elements.
Definition at line 63 of file CpuTensor.h.
|
private |
Strides of the tensor.
Definition at line 62 of file CpuTensor.h.