fast::Tensor class

N-Dimensional tensor data object.

This object represents an N-dimensional tensor. The data can be stored as a C++ pointer, and as an OpenCL buffer. The tensor data is stored as 32-bit floats.

Base classes

class SpatialDataObject
Abstract base class for all spatial data objects.

Derived classes

class TensorFlowTensor

Constructors, destructors, conversion operators

~Tensor() virtual
Tensor() protected defaulted

Public functions

void expandDims(int position = 0) virtual
auto getShape() const -> TensorShape virtual
auto getAccess(accessType type) -> TensorAccess::pointer virtual
auto getOpenCLBufferAccess(accessType type, OpenCLDevice::pointer) -> std::unique_ptr<OpenCLBufferAccess> virtual
void freeAll() override
void free(ExecutionDevice::pointer device) override
void setSpacing(VectorXf spacing) virtual
auto getSpacing() const -> VectorXf virtual
void deleteDimension(int dimension) virtual
auto getTransformedBoundingBox() const -> DataBoundingBox override
auto getBoundingBox() const -> DataBoundingBox override

Protected functions

void init(std::unique_ptr<float[]> data, TensorShape shape)
auto isInitialized() -> bool virtual
void transferCLBufferFromHost(OpenCLDevice::pointer device) virtual
void transferCLBufferToHost(OpenCLDevice::pointer device)
void updateOpenCLBufferData(OpenCLDevice::pointer device)
void setAllDataToOutOfDate()
auto hasAnyData() -> bool virtual
void updateHostData()
auto getHostDataPointer() -> float* virtual

Protected variables

std::unique_ptr<float[]> m_data
std::unordered_map<std::shared_ptr<OpenCLDevice>, cl::Buffer*> mCLBuffers
std::unordered_map<std::shared_ptr<OpenCLDevice>, bool> mCLBuffersIsUpToDate
TensorShape m_shape
bool mHostDataIsUpToDate
VectorXf m_spacing
friend TensorAccess
friend OpenCLBufferAccess

Function documentation

void fast::Tensor::expandDims(int position = 0) virtual


Create a tensor using the provided data and shape.