Class TensorBase

Class Documentation

class TensorBase

Main implementation of a tensor, a multi-dimensional matrix containing elements of a single data type.

TensorBase contains the data, data type, pointer to memory region, shape, backend info and other attributes.

Public Types

typedef IPtr<TensorBase> PtrType

Public Functions

virtual ~TensorBase()
virtual void reset(MemoryPiece::PtrType memory)
virtual MemoryPiece::PtrType memory()
virtual Type type()
virtual Shape &shape()
virtual float *data()
template<typename T>
T *data()
virtual size_t size()
template<typename T>
T scalar()
virtual float scalar()
Ptr<Backend> getBackend()
DeviceId getDeviceId()
Tensor subtensor(size_t offset, size_t size)
template<typename T>
T get(size_t i)
float get(size_t i)
template<typename T>
void get(std::vector<T> &v)
void get(io::Item &item, const std::string &name)
template<typename T>
void set(size_t i, T value)
template<typename T>
void set(const T *begin, const T *end)
template<typename T>
void set(const std::vector<T> &v)
void set(const char *begin, const char *end, Type type)
void set(const std::vector<char> &v, Type type)
void set(const io::Item &item)
template<typename T>
void set(T value)
void setSparse(const std::vector<size_t> &k, const std::vector<float> &v)
template<typename T>
void copyFrom(Tensor in)
void copyFrom(Tensor in)
template<typename T>
void swap(Tensor swapee)
void swap(Tensor swapee)
template<typename T>
std::string debug(int precision = 8, int dispCols = 5)
template std::string marian::TensorBase::debug< int64_t >(int precision = 8, int dispCols = 5)
size_t hash()

Public Static Functions

template<class ...Args>
static PtrType New(Args&&... args)