Poplar and PopLibs
SparseTensor.hpp
Go to the documentation of this file.
1// Copyright (c) 2020 Graphcore Ltd. All rights reserved.
5#ifndef popsparse_SparseTensor_hpp
6#define popsparse_SparseTensor_hpp
7
8#include <poplar/Tensor.hpp>
9
11
12namespace popsparse {
13namespace dynamic {
14
18 poplar::Tensor metaInfo;
20 poplar::Tensor nzValues;
21
23 poputil::TensorMetaData opMetaData;
24
25public:
26 SparseTensor() = default;
27
28 SparseTensor(const SparseTensor &t) = default;
29
30 SparseTensor(const poplar::Tensor &metaInfo, const poplar::Tensor &nzValues,
31 const poputil::TensorMetaData &opMetaData = {})
32 : metaInfo(metaInfo), nzValues(nzValues), opMetaData(opMetaData) {}
33
34 const poplar::Tensor &getMetaInfoTensor() const { return metaInfo; }
35
36 const poplar::Tensor &getNzValuesTensor() const { return nzValues; }
37
38 const poputil::TensorMetaData &getOpMetaData() const { return opMetaData; }
39};
40
41} // end namespace dynamic
42} // end namespace popsparse
43
44#endif // popsparse_SparseTensor_hpp
Class to allow extra data to be associated with a tensor.
A reference to a subset of tensor elements.
Definition: Tensor.hpp:38
Representation of a sparse tensor.
Definition: SparseTensor.hpp:16
Class used to represent some unspecified form of meta-data for a tensor.
Definition: TensorMetaData.hpp:19
Support for sparse matrices.
Definition: codelets.hpp:8