MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
SoftPlusLayer.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using MyCaffe.basecode;
6using MyCaffe.common;
7using MyCaffe.param;
8
9namespace MyCaffe.layers.lnn
10{
21 public class SoftPlusLayer<T> : NeuronLayer<T>
22 {
30 : base(cuda, log, p)
31 {
33 }
34
48 protected override void forward(BlobCollection<T> colBottom, BlobCollection<T> colTop)
49 {
50 long hBottomData = colBottom[0].gpu_data;
51 long hTopData = colTop[0].mutable_gpu_data;
52 int nCount = colBottom[0].count();
53
54 m_cuda.softplus_fwd(nCount, hBottomData, hTopData);
55 }
56
73 protected override void backward(BlobCollection<T> colTop, List<bool> rgbPropagateDown, BlobCollection<T> colBottom)
74 {
75 long hTopData = colTop[0].gpu_data;
76 long hTopDiff = colTop[0].gpu_diff;
77 long hBottomDiff = colBottom[0].mutable_gpu_diff;
78 long hBottomData = colBottom[0].gpu_data;
79 int nCount = colBottom[0].count();
80
81 m_cuda.softplus_bwd(nCount, hTopDiff, hTopData, hBottomDiff, hBottomData);
82 }
83 }
84}
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
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 SoftPlusLayer implements the Softplus function, a smooth approximation of the ReLU function
SoftPlusLayer(CudaDnn< T > cuda, Log log, LayerParameter p)
The SoftPlusLayer constructor.
override void backward(BlobCollection< T > colTop, List< bool > rgbPropagateDown, BlobCollection< T > colBottom)
Computes the error gradient w.r.t. the SoftPlus value inputs.
override void forward(BlobCollection< T > colBottom, BlobCollection< T > colTop)
Forward computation
Specifies the base parameter for all layers.
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.lnn namespace contains all Liquid Neural Network (LNN) related layers.
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