MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
MishLayer.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using MyCaffe.basecode;
6using MyCaffe.common;
7using MyCaffe.param;
8
10{
25 public class MishLayer<T> : NeuronLayer<T>
26 {
35 : base(cuda, log, p)
36 {
38 }
39
53 protected override void forward(BlobCollection<T> colBottom, BlobCollection<T> colTop)
54 {
55 long hBottomData = colBottom[0].gpu_data;
56 long hTopData = colTop[0].mutable_gpu_data;
57 int nCount = colBottom[0].count();
58
59 m_cuda.mish_fwd(nCount, hBottomData, hTopData, m_param.mish_param.threshold);
60 }
61
80 protected override void backward(BlobCollection<T> colTop, List<bool> rgbPropagateDown, BlobCollection<T> colBottom)
81 {
82 long hTopData = colTop[0].gpu_data;
83 long hTopDiff = colTop[0].gpu_diff;
84 long hBottomDiff = colBottom[0].mutable_gpu_diff;
85 long hBottomData = colBottom[0].gpu_data;
86 int nCount = colBottom[0].count();
87
88 m_cuda.mish_bwd(nCount, hTopDiff, hTopData, hBottomDiff, hBottomData, m_param.mish_param.threshold, m_param.mish_param.method);
89 }
90 }
91}
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 MishLayer provides a novel activation function that tends to work better than ReLU....
Definition: MishLayer.cs:26
override void backward(BlobCollection< T > colTop, List< bool > rgbPropagateDown, BlobCollection< T > colBottom)
Computes the error gradient w.r.t. the Mish value inputs.
Definition: MishLayer.cs:80
override void forward(BlobCollection< T > colBottom, BlobCollection< T > colTop)
Forward computation
Definition: MishLayer.cs:53
MishLayer(CudaDnn< T > cuda, Log log, LayerParameter p)
The MishLayer constructor.
Definition: MishLayer.cs:34
Specifies the base parameter for all layers.
MishParameter mish_param
Returns the parameter set when initialized with LayerType.MISH
LayerType
Specifies the layer type.
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.beta namespace contains all beta stage layers.
Definition: LayerFactory.cs:9
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