MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
NeuronLayer.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
10{
21 public abstract class NeuronLayer<T> : Layer<T>
22 {
30 : base(cuda, log, p)
31 {
32 }
33
37 public override int ExactNumBottomBlobs
38 {
39 get { return 1; }
40 }
41
45 public override int ExactNumTopBlobs
46 {
47 get { return 1; }
48 }
49
55 public override void LayerSetUp(BlobCollection<T> colBottom, BlobCollection<T> colTop)
56 {
57 }
58
64 public override void Reshape(BlobCollection<T> colBottom, BlobCollection<T> colTop)
65 {
66 if (!reshapeNeeded(colBottom, colTop, true))
67 return;
68
69 colTop[0].ReshapeLike(colBottom[0], colBottom[0].HalfSize);
70 }
71 }
72}
The Log class provides general output in text form.
Definition: Log.cs:13
The BlobCollection contains a list of Blobs.
void ReshapeLike(BlobCollection< T > src)
Reshapes all blobs in the collection to the sizes of the source.
The CudaDnn object is the main interface to the Low-Level Cuda C++ DLL.
Definition: CudaDnn.cs:969
An interface for the units of computation which can be composed into a Net.
Definition: Layer.cs:31
virtual bool reshapeNeeded(BlobCollection< T > colBottom, BlobCollection< T > colTop, bool bReset=true)
Tests the shapes of both the bottom and top blobs and if they are the same as the previous sizing,...
Definition: Layer.cs:622
The NeuronLayer is an interface for layers that take one blob as input (x) and produce only equally-s...
Definition: NeuronLayer.cs:22
override void Reshape(BlobCollection< T > colBottom, BlobCollection< T > colTop)
Reshape the top (output) Blob to have the same shape as the bottom (input) Blob.
Definition: NeuronLayer.cs:64
NeuronLayer(CudaDnn< T > cuda, Log log, LayerParameter p)
The NeuronLayer constructor.
Definition: NeuronLayer.cs:29
override void LayerSetUp(BlobCollection< T > colBottom, BlobCollection< T > colTop)
Setup the layer.
Definition: NeuronLayer.cs:55
override int ExactNumTopBlobs
Returns the exact number of required top (output) Blobs: output.
Definition: NeuronLayer.cs:46
override int ExactNumBottomBlobs
Returns the exact number of required bottom (input) Blobs: input.
Definition: NeuronLayer.cs:38
Specifies the base parameter for all layers.
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