Poplar and PopLibs
CTCInference.hpp
Go to the documentation of this file.
1// Copyright (c) 2021 Graphcore Ltd. All rights reserved.
8#ifndef popnn_CTCInference_hpp
9#define popnn_CTCInference_hpp
10
11#include "CTCPlan.hpp"
12
13#include <poplar/Graph.hpp>
14#include <poplar/OptionFlags.hpp>
15#include <poplar/Program.hpp>
16
17namespace popnn {
18namespace ctc_infer {
19
45ctc::Plan plan(const poplar::Graph &graph, const poplar::Type &inType,
46 unsigned batchSize, unsigned maxTime, unsigned numClasses,
47 unsigned beamwidth, const poplar::OptionFlags &options = {});
48
65 const std::size_t batchSize,
66 const std::size_t maxTime,
67 const std::size_t numClasses,
68 const ctc::Plan &plan,
69 const poplar::DebugContext &debugContext = {});
70
94std::tuple<poplar::Tensor, poplar::Tensor, poplar::Tensor>
96 const poplar::Tensor &logProbs,
97 const poplar::Tensor &dataLengths,
99 unsigned blankClass, unsigned beamwidth,
100 unsigned topPaths, const ctc::Plan &plan,
101 const poplar::DebugContext &debugContext = {},
102 const poplar::OptionFlags &options = {});
103
128std::tuple<poplar::Tensor, poplar::Tensor, poplar::Tensor>
130 const poplar::Tensor &dataLengths,
131 poplar::program::Sequence &prog, unsigned blankClass,
132 unsigned beamwidth, unsigned topPaths,
133 const ctc::Plan &plan,
134 const poplar::DebugContext &debugContext = {},
135 const poplar::OptionFlags &options = {});
136} // namespace ctc_infer
137} // namespace popnn
138
139#endif // popnn_CTCLoss_hpp
std::tuple< poplar::Tensor, poplar::Tensor, poplar::Tensor > beamSearchDecoderLogits(poplar::Graph &graph, const poplar::Tensor &logits, const poplar::Tensor &dataLengths, poplar::program::Sequence &prog, unsigned blankClass, unsigned beamwidth, unsigned topPaths, const ctc::Plan &plan, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={})
Calculate the most likely topPaths labels and their probabilities given the input logits with lengths...
ctc::Plan plan(const poplar::Graph &graph, const poplar::Type &inType, unsigned batchSize, unsigned maxTime, unsigned numClasses, unsigned beamwidth, const poplar::OptionFlags &options={})
Create a plan for implementing the CTC Beam search inference function.
std::tuple< poplar::Tensor, poplar::Tensor, poplar::Tensor > beamSearchDecoderLogProbabilities(poplar::Graph &graph, const poplar::Tensor &logProbs, const poplar::Tensor &dataLengths, poplar::program::Sequence &prog, unsigned blankClass, unsigned beamwidth, unsigned topPaths, const ctc::Plan &plan, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={})
Calculate the most likely topPaths labels and their probabilities given the input logProbs with lengt...
poplar::Tensor createDataInput(poplar::Graph &graph, const poplar::Type &type, const std::size_t batchSize, const std::size_t maxTime, const std::size_t numClasses, const ctc::Plan &plan, const poplar::DebugContext &debugContext={})
Create and map a data input [maxTime, batchSize, numClasses] tensor which the beam search function wi...
Support for planning Connectionist Temporal Classification (CTC) Operations.
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
An object representing a plan that describes how to map tensors and implement the CTC Loss or CTC Inf...
Definition: CTCPlan.hpp:19
Functions used in neural networks.
Definition: BatchNorm.hpp:14