SMAUG
Simulating Machine Learning Applications on gem5-Aladdin
|
Utility functions for copying/printing/tiling tensors. More...
#include <cstring>
#include <iostream>
#include <vector>
#include "smaug/core/tensor.h"
Go to the source code of this file.
Namespaces | |
smaug | |
The smaug namespace is the parent namespace of all C++ code in SMAUG. | |
Functions | |
std::ostream & | smaug::operator<< (std::ostream &os, const TensorIndexIterator &iter) |
std::ostream & | smaug::operator<< (std::ostream &os, const TensorShape &shape) |
std::ostream & | smaug::operator<< (std::ostream &os, const Tensor &tensor) |
template<typename DType > | |
void | smaug::printTensorElement (std::ostream &os, const DType *data, int index) |
template<> | |
void | smaug::printTensorElement< float16 > (std::ostream &os, const float16 *data, int index) |
template<typename DType > | |
void | smaug::writeTensorToOstream (std::ostream &os, const Tensor &tensor) |
Pretty-print a Tensor's name, shape, and contents to the provided ostream. | |
template<typename DType > | |
void | smaug::internal::copyTensorRegion (Tensor *dest, Tensor *src, const std::vector< int > &destOrigin, const std::vector< int > &srcOrigin, const std::vector< int > ®ionSize) |
template<typename DType > | |
void | smaug::internal::copyRawTensorData (Tensor *dest, Tensor *src, int destOffset, int srcOffset, int copySize) |
template<typename DType > | |
void | smaug::internal::copyTensorData (Tensor *dest, Tensor *src, std::vector< int > destOrigin, std::vector< int > srcOrigin, int copySize) |
void | smaug::copyTensorRegion (Tensor *dest, Tensor *src, std::vector< int > destOrigin, std::vector< int > srcOrigin, std::vector< int > regionSize) |
Copies a region of a source Tensor to a corresponding region in a destination Tensor. More... | |
void | smaug::copyTensorData (Tensor *dest, Tensor *src, std::vector< int > destOffset, std::vector< int > srcOffset, int copySize) |
Similar to copyTensorRegion, but the region is a contiguous block of memory. | |
void | smaug::copyRawTensorData (Tensor *dest, Tensor *src, int destOffset, int srcOffset, int copySize) |
Directly copies a linear region of memory from dest to src, without taking dimensions/padding into account. More... | |
TiledTensor | smaug::generateTiledTensorPerBatchNC (Tensor *tensor, const TensorShape &tileShape, Operator *op, bool copyData=true) |
Tile the provided NC Tensor per batch. More... | |
TiledTensor | smaug::generateTiledTensorWithStrideAndPadding (Tensor *tensor, const TensorShape &tileShape, Operator *op, int fieldRows, int fieldCols, int rowStride, int colStride, PaddingType paddingType, bool copyData=false) |
Generates a TiledTensor from a source Tensor with the specified tile shape. More... | |
TiledTensor | smaug::generateTiledTensor (Tensor *tensor, const TensorShape &tileShape, Operator *op, bool copyData=false) |
Generates a TiledTensor from a source Tensor. More... | |
void | smaug::flattenTiledTensor (TiledTensor &tiledTensor, Tensor *destTensor) |
Copies the data from each tile in a TiledTensor into a destination Tensor as a contiguous block of memory, as if only one dimension ever existed. | |
Tensor * | smaug::concatTensors (std::vector< Tensor * > inputTensors, int concatDim, Workspace *workspace) |
Concatenates Tensors on the specified dimension into one single tensor. | |
Utility functions for copying/printing/tiling tensors.
Definition in file tensor_utils.h.