Esempio n. 1
0
        private LayerBase <T> LoadAffineActivationLayer(AffineActivation activation, BinaryReader reader)
        {
            switch (activation)
            {
            case AffineActivation.Sigmoid:
                return(new SigmoidLayer <T>(reader));

            case AffineActivation.Tanh:
                return(new TanhLayer <T>(reader));

            default:
                throw new ArgumentOutOfRangeException(nameof(activation), activation, null);
            }
        }
Esempio n. 2
0
        private LayerBase <T> GetAffineActivationLayer(AffineActivation activation, int ySize)
        {
            switch (activation)
            {
            case AffineActivation.Sigmoid:
                return(new SigmoidLayer <T>(ySize));

            case AffineActivation.Tanh:
                return(new TanhLayer <T>(ySize));

            default:
                throw new ArgumentOutOfRangeException(nameof(activation), activation, null);
            }
        }
Esempio n. 3
0
 public AffineLayer(AffineLayer <T> other) : base(other)
 {
     _activationType  = other._activationType;
     _linearLayer     = (LinearLayer <T>)other._linearLayer.Clone();
     _activationLayer = other._activationLayer.Clone();
 }
Esempio n. 4
0
 public AffineLayer(int xSize, int ySize, AffineActivation activation, IMatrixInitializer <T> matrixInitializer)
 {
     _activationType  = activation;
     _linearLayer     = new LinearLayer <T>(xSize, ySize, matrixInitializer);
     _activationLayer = GetAffineActivationLayer(activation, ySize);
 }
Esempio n. 5
0
 public AffineLayer(int xSize, int ySize, AffineActivation activation)
 {
     _activationType  = activation;
     _linearLayer     = new LinearLayer <T>(xSize, ySize);
     _activationLayer = GetAffineActivationLayer(activation, ySize);
 }