Poplar and PopLibs
MatMulParams.hpp
Go to the documentation of this file.
1// Copyright (c) 2020 Graphcore Ltd. All rights reserved.
6#ifndef popsparse_MatMulParams_hpp
7#define popsparse_MatMulParams_hpp
8
10
11#include <ostream>
12
13namespace popsparse {
14namespace dynamic {
15
16class MatMulParams {
17 SparsityParams sparsityParams;
18 double nzRatio;
19 std::size_t groups;
20 std::size_t m;
21 std::size_t k;
22 std::size_t n;
23
24public:
35 static MatMulParams createWithNzRatio(const SparsityParams &sparsityParams,
36 double nzRatio, std::size_t groups,
37 std::size_t m, std::size_t k,
38 std::size_t n);
39 static MatMulParams
40 createWithNumNonZeroValues(const SparsityParams &sparsityParams,
41 std::size_t numNonZeroElems, std::size_t groups,
42 std::size_t m, std::size_t k, std::size_t n);
43 const SparsityParams &getSparsityParams() const { return sparsityParams; }
44 std::size_t getNumGroups() const { return groups; }
45 std::size_t getM() const { return m; }
46 std::size_t getK() const { return k; }
47 std::size_t getN() const { return n; }
48 double getNzRatio() const;
49 std::size_t getNumNonZeroValues() const;
50
51 friend bool operator<(const MatMulParams &a, const MatMulParams &b);
52 friend bool operator==(const MatMulParams &a, const MatMulParams &b);
53 friend bool operator!=(const MatMulParams &a, const MatMulParams &b);
54};
55
56std::ostream &operator<<(std::ostream &, const MatMulParams &);
57
58} // end namespace dynamic
59} // end namespace popsparse
60
61#endif // popsparse_MatMulParams_hpp
Parameters used for sparse tensors.
std::ostream & operator<<(std::ostream &os, const CollectiveOperator &op)
Write op to output stream os.
Support for sparse matrices.
Definition: codelets.hpp:8