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 AbsValLayer<T> : NeuronLayer<T>
21 {
29 : base(cuda, log, p)
30 {
32 }
43 protected override void forward(BlobCollection<T> colBottom, BlobCollection<T> colTop)
44 {
45 int nCount = colTop[0].count();
46 long hBottomData = colBottom[0].gpu_data;
47 long hTopData = colTop[0].mutable_gpu_data; ;
49 m_cuda.abs(nCount, hBottomData, hTopData);
50 }
67 protected override void backward(BlobCollection<T> colTop, List<bool> rgbPropagateDown, BlobCollection<T> colBottom)
68 {
69 if (!rgbPropagateDown[0])
70 return;
72 int nCount = colTop[0].count();
73 long hTopDiff = colTop[0].gpu_diff;
74 long hBottomData = colBottom[0].gpu_data;
75 long hBottomDiff = colBottom[0].mutable_gpu_diff;
77 m_cuda.sign(nCount, hBottomData, hBottomDiff);
78 m_cuda.mul(nCount, hBottomDiff, hTopDiff, hBottomDiff);
79 }
80 }
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
The AbsValLayer computes the absolute value of the input.
Definition: AbsValLayer.cs:21
override void backward(BlobCollection< T > colTop, List< bool > rgbPropagateDown, BlobCollection< T > colBottom)
Computes the error gradient w.r.t. the absolute value inputs.
Definition: AbsValLayer.cs:67
override void forward(BlobCollection< T > colBottom, BlobCollection< T > colTop)
Definition: AbsValLayer.cs:43
AbsValLayer(CudaDnn< T > cuda, Log log, LayerParameter p)
The AbsValLayer constructor.
Definition: AbsValLayer.cs:28
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
Specifies the base parameter for all layers.
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 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