Deep learning software for Windows C# programmers.
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using MyCaffe.basecode;
6using MyCaffe.common;
7using MyCaffe.param;
9namespace MyCaffe.layers
20 public class ThresholdLayer<T> : NeuronLayer<T>
21 {
22 double m_dfThreshold = 0;
34 : base(cuda, log, p)
35 {
37 }
44 public override void LayerSetUp(BlobCollection<T> colBottom, BlobCollection<T> colTop)
45 {
46 base.LayerSetUp(colBottom, colTop);
48 m_dfThreshold = m_param.threshold_param.threshold;
49 }
67 protected override void forward(BlobCollection<T> colBottom, BlobCollection<T> colTop)
68 {
69 long hBottomData = colBottom[0].gpu_data;
70 long hTopData = colTop[0].mutable_gpu_data;
71 int nCount = colBottom[0].count();
73 m_cuda.threshold_fwd(nCount, m_dfThreshold, hBottomData, hTopData);
74 }
77 protected override void backward(BlobCollection<T> colTop, List<bool> rgbPropagateDown, BlobCollection<T> colBottom)
78 {
79 throw new NotImplementedException();
80 }
81 }
The Log class provides general output in text form.
Definition: Log.cs:13
The BlobCollection contains a list of Blobs.
The CudaDnn object is the main interface to the Low-Level Cuda C++ DLL.
Definition: CudaDnn.cs:969
LayerParameter m_param
Specifies the LayerParameter describing the Layer.
Definition: Layer.cs:47
CudaDnn< T > m_cuda
Specifies the CudaDnn connection to Cuda.
Definition: Layer.cs:39
LayerParameter.LayerType m_type
Specifies the Layer type.
Definition: Layer.cs:35
The NeuronLayer is an interface for layers that take one blob as input (x) and produce only equally-s...
Definition: NeuronLayer.cs:22
The ThresholdLayer is a neuron layer that tests whether the input exceeds a threshold: outputs 1 for ...
override void backward(BlobCollection< T > colTop, List< bool > rgbPropagateDown, BlobCollection< T > colBottom)
Not implemented (non-diferentiable function)
override void forward(BlobCollection< T > colBottom, BlobCollection< T > colTop)
The forward computation.
ThresholdLayer(CudaDnn< T > cuda, Log log, LayerParameter p)
The ThresholdLayer constructor.
override void LayerSetUp(BlobCollection< T > colBottom, BlobCollection< T > colTop)
Setup the layer to run in either Engine.CAFFE or Engine.CUDNN mode.
Specifies the base parameter for all layers.
ThresholdParameter threshold_param
Returns the parameter set when initialized with LayerType.THRESHOLD
Specifies the layer type.
double threshold
Specifies the threshold value which must be strictly positive values.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
Definition: Annotation.cs:12
The MyCaffe.common namespace contains common MyCaffe classes.
Definition: BatchInput.cs:8
The MyCaffe.layers namespace contains all layers that have a solidified code base,...
Definition: LayerFactory.cs:15
The MyCaffe.param namespace contains parameters used to create models.
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...
Definition: Annotation.cs:12