Poplar and PopLibs
Embedding.hpp
Go to the documentation of this file.
1// Copyright (c) 2020 Graphcore Ltd. All rights reserved.
6#ifndef popsparse_Embedding_hpp
7#define popsparse_Embedding_hpp
8
9#include <poplar/Graph.hpp>
10#include <poplar/Interval.hpp>
11
15
16namespace popsparse {
17namespace dynamic {
18
34createIndicesTensor(poplar::Graph &graph, const FullyConnectedParams &params,
35 std::size_t numIndices,
36 const poplar::OptionFlags &options = {},
37 const poplar::DebugContext &debugContext = {});
38
58 const poplar::Type &dataType,
59 const FullyConnectedParams &params,
60 std::size_t numIndices,
61 const poplar::DebugContext &debugContext = {},
62 const poplar::OptionFlags &options = {},
63 PlanningCache *cache = nullptr);
64
81 const poplar::Tensor &indices,
83 const FullyConnectedParams &params,
84 const poplar::DebugContext &debugContext = {},
85 const poplar::OptionFlags &options = {},
86 PlanningCache *cache = nullptr);
87
105 poplar::Graph &graph, const SparseTensor &t, const poplar::Tensor &slices,
106 const poplar::Tensor &indices, const poplar::Tensor &scale,
107 poplar::program::Sequence &prog, const FullyConnectedParams &params,
108 const poplar::DebugContext &debugContext = {},
109 const poplar::OptionFlags &options = {}, PlanningCache *cache = nullptr);
110
111} // end namespace dynamic
112
113} // namespace popsparse
114
115#endif // popsparse_Embedding_hpp
Parameters used for fully-connected layers using sparse tensors.
Basic representation of a sparse tensor.
DebugContext gathers the common external parameters of the context of an operation.
Definition: DebugContext.hpp:221
This class represents a graph program to be executed on the IPU.
Definition: Graph.hpp:52
A set of option/value string flags to be used in various APIs.
Definition: OptionFlags.hpp:24
A reference to a subset of tensor elements.
Definition: Tensor.hpp:38
Class representing device data types.
Definition: Type.hpp:42
Program that executes a sequence of programs.
Definition: Program.hpp:77
Representation of a sparse tensor.
Definition: SparseTensor.hpp:16
poplar::Tensor createSliceTensor(poplar::Graph &graph, const poplar::Type &dataType, const FullyConnectedParams &params, std::size_t numIndices, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
Create and map a tensor to be updated from efficiently.
poplar::Tensor createIndicesTensor(poplar::Graph &graph, const FullyConnectedParams &params, std::size_t numIndices, const poplar::OptionFlags &options={}, const poplar::DebugContext &debugContext={})
Create and map a tensor to contain indices for slicing/updating a tensor efficiently.
void embeddingUpdateAdd(poplar::Graph &graph, const SparseTensor &t, const poplar::Tensor &slices, const poplar::Tensor &indices, const poplar::Tensor &scale, poplar::program::Sequence &prog, const FullyConnectedParams &params, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
Update a sparse tensor with a set of slices at the given row indices.
poplar::Tensor embeddingSlice(poplar::Graph &graph, const SparseTensor &t, const poplar::Tensor &indices, poplar::program::Sequence &prog, const FullyConnectedParams &params, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
Take multiple slices from a base tensor.
Support for sparse matrices.
Definition: codelets.hpp:8
Fully-connected layers using sparse tensors.