Poplar and PopLibs
Loss.hpp
Go to the documentation of this file.
1// Copyright (c) 2016 Graphcore Ltd. All rights reserved.
6#ifndef popnn_Loss_hpp
7#define popnn_Loss_hpp
8
9namespace popnn {
10
11enum LossType { SUM_SQUARED_LOSS, CROSS_ENTROPY_LOSS };
12
13} // end namespace popnn
14
15#ifndef __POPC__
17#include <poplar/Graph.hpp>
18#include <poplar/Program.hpp>
19#include <poplar/Tensor.hpp>
20
21namespace popnn {
22
54calcLoss(poplar::Graph &graph, const poplar::Tensor &modelOutputs,
55 const poplar::Tensor &expected, const poplar::Tensor &loss,
56 const poplar::Tensor &deltas, const poplar::Tensor &deltasScale,
57 const poplar::Tensor &modelOutputScaling, LossType lossType,
58 const poplar::DebugContext &debugContext = {});
59
61calcLoss(poplar::Graph &graph, const poplar::Tensor &modelOutputs,
62 const poplar::Tensor &expected, const poplar::Tensor &loss,
63 const poplar::Tensor &deltas, LossType lossType,
64 const poplar::DebugContext &debugContext = {});
65
76calcLoss(poplar::Graph &graph, const poplar::Tensor &modelOutputs,
77 const poplar::Tensor &expected, const poplar::Tensor &loss,
78 const poplar::Tensor &deltas, const poplar::Tensor &deltasScale,
79 const poplar::Tensor &modelOutputScaling,
80 const poplar::Tensor &numCorrect, LossType lossType,
81 const poplar::DebugContext &debugContext = {});
82
84calcLoss(poplar::Graph &graph, const poplar::Tensor &modelOutputs,
85 const poplar::Tensor &expected, const poplar::Tensor &loss,
86 const poplar::Tensor &deltas, const poplar::Tensor &numCorrect,
87 LossType lossType, const poplar::DebugContext &debugContext = {});
88
108calcAccuracy(poplar::Graph &graph, const poplar::Tensor &modelOutputs,
109 const poplar::Tensor &expected, const poplar::Tensor &numCorrect,
110 const poplar::DebugContext &debugContext = {});
111
122poplar::Tensor argMax(poplar::Graph &graph, const poplar::Tensor &input,
124 const poplar::DebugContext &debugContext = {});
125
136std::pair<poplar::Tensor, poplar::Tensor>
137maxAndArgMax(poplar::Graph &graph, const poplar::Tensor &input,
139 const poplar::DebugContext &debugContext = {});
140
151poplar::Tensor argMin(poplar::Graph &graph, const poplar::Tensor &input,
153 const poplar::DebugContext &debugContext = {});
154
165std::pair<poplar::Tensor, poplar::Tensor>
166minAndArgMin(poplar::Graph &graph, const poplar::Tensor &input,
168 const poplar::DebugContext &debugContext = {});
169
183 poplar::Tensor &indices, unsigned K, bool sort,
185 const poplar::DebugContext &debugContext = {});
186
187} // end namespace popnn
188
189#endif // !__POPC__
190
191#endif // popnn_Loss_hpp
Constants used by encoding functions.
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 reference to a subset of tensor elements.
Definition: Tensor.hpp:38
This class represents a control program that executes operations on the graph.
Definition: Program.hpp:30
Program that executes a sequence of programs.
Definition: Program.hpp:77
Functions used in neural networks.
Definition: BatchNorm.hpp:14
poplar::Tensor topK(poplar::Graph &graph, poplar::program::Sequence &prog, const poplar::Tensor &t, const TopKParams &params, const poplar::DebugContext &debugContext={})
Return the top k values in the innermost dimension of a tensor.
poplar::Tensor sort(poplar::Graph &graph, const poplar::Tensor &t, unsigned dim, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={})