8 #include <boost/core/ignore_unused.hpp> 18 : m_RangeTracker(rangeTracker)
21 void StaticRangeVisitor::SetRange(
const IConnectableLayer* layer,
unsigned int outputIdx,
float min,
float max)
23 m_RangeTracker.
SetRange(layer, outputIdx, min, max);
29 SetRange(layer, 0, parentRange.first, parentRange.second);
34 boost::ignore_unused(name);
35 SetRange(layer, 0, -20.f, 20.f);
46 boost::ignore_unused(desc);
47 boost::ignore_unused(mean);
48 boost::ignore_unused(variance);
49 boost::ignore_unused(beta);
50 boost::ignore_unused(gamma);
51 boost::ignore_unused(name);
52 SetRange(layer, 0, -15.0f, 15.0f);
61 boost::ignore_unused(convolution2dDescriptor);
62 boost::ignore_unused(weights);
63 boost::ignore_unused(biases);
64 boost::ignore_unused(name);
65 SetRange(layer, 0, -15.0f, 15.0f);
74 boost::ignore_unused(desc);
75 boost::ignore_unused(weights);
76 boost::ignore_unused(biases);
77 boost::ignore_unused(name);
78 SetRange(layer, 0, -15.0f, 15.0f);
85 boost::ignore_unused(name);
93 SetRange(layer, 0, 0.f, 15.f);
96 SetRange(layer, 0, 0.f, activationDescriptor.
m_A);
99 SetRange(layer, 0, -1.f, 1.f);
102 SetRange(layer, 0, -5.f, 15.f);
105 SetRange(layer, 0, -15.f, 15.f);
116 boost::ignore_unused(desc);
117 boost::ignore_unused(weights);
118 boost::ignore_unused(biases);
119 boost::ignore_unused(name);
120 SetRange(layer, 0, -15.0f, 15.0f);
127 boost::ignore_unused(permuteDescriptor);
128 boost::ignore_unused(name);
129 ForwardParentParameters(layer);
136 boost::ignore_unused(spaceToBatchNdDescriptor);
137 boost::ignore_unused(name);
138 ForwardParentParameters(layer);
145 boost::ignore_unused(pooling2dDescriptor);
146 boost::ignore_unused(name);
147 ForwardParentParameters(layer);
154 boost::ignore_unused(softmaxDescriptor);
155 boost::ignore_unused(name);
156 SetRange(layer, 0, 0.f, 1.f);
163 boost::ignore_unused(originsDescriptor);
164 boost::ignore_unused(name);
165 float min = std::numeric_limits<float>::max();
166 float max = std::numeric_limits<float>::lowest();
173 min = std::min(min, range.first);
174 max = std::max(max, range.second);
176 SetRange(layer, 0, min, max);
183 boost::ignore_unused(name);
192 const float* inputData =
reinterpret_cast<const float*
>(input.
GetMemoryArea());
194 float min = std::numeric_limits<float>::max();
195 float max = std::numeric_limits<float>::lowest();
197 for (
unsigned int i = 0; i < inputNumElements; i++)
199 const float inputValue = inputData[i];
201 min = std::min(min, inputValue);
202 max = std::max(max, inputValue);
204 SetRange(layer, 0, min, max);
211 boost::ignore_unused(reshapeDescriptor);
212 boost::ignore_unused(name);
213 ForwardParentParameters(layer);
220 boost::ignore_unused(splitterDescriptor);
221 boost::ignore_unused(name);
222 ForwardParentParameters(layer);
229 boost::ignore_unused(resizeDesc);
230 boost::ignore_unused(name);
231 ForwardParentParameters(layer);
238 boost::ignore_unused(resizeDescriptor);
239 boost::ignore_unused(name);
240 ForwardParentParameters(layer);
247 boost::ignore_unused(stridedSliceDescriptor);
248 boost::ignore_unused(name);
249 ForwardParentParameters(layer);
256 boost::ignore_unused(batchToSpaceNdDescriptor);
257 boost::ignore_unused(name);
258 ForwardParentParameters(layer);
float m_A
Alpha upper bound value used by the activation functions. (BoundedReLu, Linear, TanH).
virtual const IInputSlot & GetInputSlot(unsigned int index) const =0
A BatchToSpaceNdDescriptor for the BatchToSpaceNdLayer.
DataType GetDataType() const
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
void VisitReshapeLayer(const IConnectableLayer *layer, const ReshapeDescriptor &reshapeDescriptor, const char *name=nullptr) override
void VisitActivationLayer(const IConnectableLayer *layer, const ActivationDescriptor &activationDescriptor, const char *name=nullptr) override
unsigned int GetNumElements() const
void VisitStridedSliceLayer(const IConnectableLayer *layer, const StridedSliceDescriptor &stridedSliceDescriptor, const char *name=nullptr) override
void VisitDepthwiseConvolution2dLayer(const IConnectableLayer *layer, const DepthwiseConvolution2dDescriptor &desc, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name=nullptr) override
An ActivationDescriptor for the ActivationLayer.
std::pair< float, float > MinMaxRange
A BatchNormalizationDescriptor for the BatchNormalizationLayer.
void VisitPermuteLayer(const IConnectableLayer *layer, const PermuteDescriptor &permuteDescriptor, const char *name) override
void VisitSoftmaxLayer(const IConnectableLayer *layer, const SoftmaxDescriptor &softmaxDescriptor, const char *name=nullptr) override
A ViewsDescriptor for the SplitterLayer. Descriptor to configure the splitting process. Number of Views must be equal to the number of outputs, and their order must match - e.g. first view corresponds to the first output, second view to the second output, etc.
void VisitResizeLayer(const IConnectableLayer *layer, const ResizeDescriptor &resizeDescriptor, const char *name=nullptr) override
void VisitBatchToSpaceNdLayer(const IConnectableLayer *layer, const BatchToSpaceNdDescriptor &batchToSpaceNdDescriptor, const char *name=nullptr) override
virtual LayerGuid GetOwningLayerGuid() const =0
void VisitSpaceToBatchNdLayer(const IConnectableLayer *layer, const SpaceToBatchNdDescriptor &spaceToBatchNdDescriptor, const char *name=nullptr) override
void VisitFullyConnectedLayer(const IConnectableLayer *layer, const FullyConnectedDescriptor &desc, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name) override
A ReshapeDescriptor for the ReshapeLayer.
void VisitConvolution2dLayer(const IConnectableLayer *layer, const Convolution2dDescriptor &convolution2dDescriptor, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name=nullptr) override
void VisitResizeBilinearLayer(const IConnectableLayer *layer, const ResizeBilinearDescriptor &resizeDesc, const char *name=nullptr) override
void VisitConstantLayer(const IConnectableLayer *layer, const ConstTensor &input, const char *name=nullptr) override
void VisitAdditionLayer(const IConnectableLayer *layer, const char *name=nullptr) override
Functions to set the Range on a per-layer-type basis.
A FullyConnectedDescriptor for the FullyConnectedLayer.
void VisitConcatLayer(const IConnectableLayer *layer, const OriginsDescriptor &originsDescriptor, const char *name=nullptr) override
A ResizeBilinearDescriptor for the ResizeBilinearLayer.
ActivationFunction m_Function
The activation function to use (Sigmoid, TanH, Linear, ReLu, BoundedReLu, SoftReLu, LeakyReLu, Abs, Sqrt, Square).
A SoftmaxDescriptor for the SoftmaxLayer.
An output connection slot for a layer. The output slot may be connected to 1 or more input slots of s...
void SetRange(const IConnectableLayer *layer, unsigned int outputIdx, float min, float max)
Set the range for an output slot on a layer.
void VisitSplitterLayer(const IConnectableLayer *layer, const SplitterDescriptor &splitterDescriptor, const char *name=nullptr) override
void VisitPooling2dLayer(const IConnectableLayer *layer, const Pooling2dDescriptor &pooling2dDescriptor, const char *name) override
MinMaxRange GetRange(LayerGuid guid, unsigned int idx) const
Retrieve the Range for a particular output slot on a particular layer.
StaticRangeVisitor(RangeTracker &rangeTracker)
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
MemoryType GetMemoryArea() const
A Pooling2dDescriptor for the Pooling2dLayer.
virtual unsigned int GetNumInputSlots() const =0
void VisitBatchNormalizationLayer(const IConnectableLayer *layer, const BatchNormalizationDescriptor &desc, const ConstTensor &mean, const ConstTensor &variance, const ConstTensor &beta, const ConstTensor &gamma, const char *name=nullptr) override
virtual unsigned int CalculateIndexOnOwner() const =0
A DepthwiseConvolution2dDescriptor for the DepthwiseConvolution2dLayer.
A PermuteDescriptor for the PermuteLayer.
A Convolution2dDescriptor for the Convolution2dLayer.
A SpaceToBatchNdDescriptor for the SpaceToBatchNdLayer.
A ResizeDescriptor for the ResizeLayer.
An OriginsDescriptor for the ConcatLayer. Descriptor to configure the concatenation process...
A StridedSliceDescriptor for the StridedSliceLayer.