2 #include "linearhostmemory.h"
11 template<
typename PixelType>
20 LinearHostMemory<PixelType, 1>(), samples_(0), channels_(0), height_(0), width_(0)
35 TensorCpu(
const unsigned int N,
const unsigned int C,
const unsigned int H,
const unsigned int W) :
36 LinearHostMemory<PixelType, 1>(N * C * H * W), samples_(N), channels_(C), height_(H), width_(W)
48 TensorCpu(PixelType* host_data,
const unsigned int N,
const unsigned int C,
const unsigned int H,
49 const unsigned int W,
bool ext_data_pointer =
false) :
50 LinearHostMemory<PixelType, 1>(host_data, N * C * H * W, ext_data_pointer), samples_(N), channels_(C), height_(H), width_(
58 PixelType
getPixel(
unsigned int n,
unsigned int c,
unsigned int x,
unsigned int y)
60 return *this->
data(n * (channels_ * height_ * width_) + c * (width_ * height_) + x * width_ + y);
91 out <<
"Tensor: height=" << tensor.
height() <<
" width="
92 << tensor.
width() <<
" samples=" << tensor.
samples() <<
" channels="
105 unsigned int samples_;
107 unsigned int channels_;
109 unsigned int height_;
virtual ~TensorCpu()
Definition: tensor_cpu.h:25
unsigned int height() const
Definition: tensor_cpu.h:76
unsigned int samples() const
Definition: tensor_cpu.h:64
Linear host memory class.
Definition: linearhostmemory.h:33
PixelType getPixel(unsigned int n, unsigned int c, unsigned int x, unsigned int y)
Definition: tensor_cpu.h:58
unsigned int channels() const
Definition: tensor_cpu.h:70
Definition: image_cpu.h:7
TensorCpu(PixelType *host_data, const unsigned int N, const unsigned int C, const unsigned int H, const unsigned int W, bool ext_data_pointer=false)
Definition: tensor_cpu.h:48
ndarray_ref< PixelType, 4 > ref() const
unsigned int width() const
Definition: tensor_cpu.h:82
TensorCpu()
Definition: tensor_cpu.h:19
Host 4D tensor class.
Definition: tensor_cpu.h:12
friend std::ostream & operator<<(std::ostream &out, TensorCpu const &tensor)
Definition: tensor_cpu.h:88
PixelType pixel_type
Definition: tensor_cpu.h:16
PixelType * data(unsigned int offset=0)
Definition: linearhostmemory.h:137
virtual bool onDevice() const
Definition: linearhostmemory.h:194
TensorCpu(const unsigned int N, const unsigned int C, const unsigned int H, const unsigned int W)
Definition: tensor_cpu.h:35