MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
LayerFactory.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6using MyCaffe.basecode;
7using MyCaffe.common;
8using MyCaffe.db.image;
9using MyCaffe.param;
10
19{
24 {
35 {
36 switch (p.type)
37 {
38 case LayerParameter.LayerType.EVENT:
39 return new EventLayer<double>(cuda, log, p);
40
41 case LayerParameter.LayerType.GRAM:
42 return new GramLayer<double>(cuda, log, p);
43
44 case LayerParameter.LayerType.ONEHOT:
45 return new OneHotLayer<double>(cuda, log, p);
46
47 case LayerParameter.LayerType.SCALAR:
48 return new ScalarLayer<double>(cuda, log, p);
49
50 case LayerParameter.LayerType.TV_LOSS:
51 return new TVLossLayer<double>(cuda, log, p);
52
53 default:
54 return null;
55 }
56 }
57
68 {
69 switch (p.type)
70 {
71 case LayerParameter.LayerType.EVENT:
72 return new EventLayer<float>(cuda, log, p);
73
74 case LayerParameter.LayerType.GRAM:
75 return new GramLayer<float>(cuda, log, p);
76
77 case LayerParameter.LayerType.ONEHOT:
78 return new OneHotLayer<float>(cuda, log, p);
79
80 case LayerParameter.LayerType.SCALAR:
81 return new ScalarLayer<float>(cuda, log, p);
82
83 case LayerParameter.LayerType.TV_LOSS:
84 return new TVLossLayer<float>(cuda, log, p);
85
86 default:
87 return null;
88 }
89 }
90 }
91}
The CancelEvent provides an extension to the manual cancel event that allows for overriding the manua...
Definition: CancelEvent.cs:17
The Log class provides general output in text form.
Definition: Log.cs:13
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
The EventLayer provides an event that fires on the forward pass and another that fires on the backwar...
Definition: EventLayer.cs:23
The GramLayer computes the Gram matrix used in Neural Style.
Definition: GramLayer.cs:22
The LayerFactor is responsible for creating all layers implemented in the MyCaffe....
Definition: LayerFactory.cs:24
Layer< float > CreateSingle(CudaDnn< float > cuda, Log log, LayerParameter p, CancelEvent evtCancel, IXDatabaseBase db)
Create the layers when using the float base type.
Definition: LayerFactory.cs:67
Layer< double > CreateDouble(CudaDnn< double > cuda, Log log, LayerParameter p, CancelEvent evtCancel, IXDatabaseBase db)
Create the layers when using the double base type.
Definition: LayerFactory.cs:34
The OneHotLayer is a layer for converting real values into a one-hot vector where a 1 is placed withi...
Definition: OneHotLayer.cs:36
The ScalarLayer computes the operation with the value on the input.
Definition: ScalarLayer.cs:21
The TVLossLayer computes total variation loss as described by 'Mahendran' et al., and used in Neural ...
Definition: TVLossLayer.cs:22
Specifies the base parameter for all layers.
LayerType type
Specifies the type of this LayerParameter.
LayerType
Specifies the layer type.
The ILayerCreator interface is implemented by each MyCaffe.layers.x layer extension dll and is used t...
Definition: Interfaces.cs:19
The IXDatabaseBase interface defines the general interface to the in-memory database.
Definition: Interfaces.cs:444
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.db.image namespace contains all image database related classes.
Definition: Database.cs:18
The MyCaffe.layers.nt namespace contains all Neural Transfer related layers.
Definition: LayerFactory.cs:19
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