Exemple #1
0
        public static Filler Create(FillerConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            Contract.Ensures(Contract.Result <Filler>() != null);
            Contract.EndContractBlock();

            switch (configuration.Type)
            {
            case FillerType.Constant: return(new ConstantFiller((ConstantFillerConfiguration)configuration));

            case FillerType.Gaussian: return(new GaussianFiller((GaussianFillerConfiguration)configuration));

            case FillerType.PositiveUnitball: return(new PositiveUnitballFiller((PositiveUnitballFillerConfiguration)configuration));

            case FillerType.Uniform: return(new UniformFiller((UniformFillerConfiguration)configuration));

            case FillerType.Xavier: return(new XavierFiller((XavierFillerConfiguration)configuration));

            default: throw new NotSupportedException(string.Format("Filler type {0} is not supported by the FillerFactory", configuration.Type));
            }
        }
        public InnerProductLayerConfiguration(int outputs, bool bias = true, FillerConfiguration weightsFiller = null, FillerConfiguration biasFiller = null)
            : base(LayerType.Dropout)
        {
            Contract.Requires(outputs > 0);

            Guard.That(() => outputs).IsGreaterThan(0);

            this.Outputs = outputs;
            this.UseBias = bias;

            this.WeightsFiller = weightsFiller ?? new XavierFillerConfiguration();
            this.BiasFiller    = biasFiller ?? new ConstantFillerConfiguration();
        }
 public InnerProductLayer(int outputs, bool bias = true, FillerConfiguration weightsFiller = null, FillerConfiguration biasFiller = null)
     : this(new InnerProductLayerConfiguration(outputs, bias, weightsFiller, biasFiller))
 {
 }
Exemple #4
0
        public static Filler Create(FillerConfiguration configuration)
        {
            if (configuration == null)
                throw new ArgumentNullException("configuration");

            Contract.Ensures(Contract.Result<Filler>() != null);
            Contract.EndContractBlock();

            switch ( configuration.Type )
            {
                case FillerType.Constant: return new ConstantFiller((ConstantFillerConfiguration)configuration);
                case FillerType.Gaussian: return new GaussianFiller((GaussianFillerConfiguration)configuration);
                case FillerType.PositiveUnitball: return new PositiveUnitballFiller((PositiveUnitballFillerConfiguration)configuration);
                case FillerType.Uniform: return new UniformFiller((UniformFillerConfiguration)configuration);
                case FillerType.Xavier: return new XavierFiller((XavierFillerConfiguration)configuration);
                default: throw new NotSupportedException(string.Format("Filler type {0} is not supported by the FillerFactory", configuration.Type));
            }
        }