コード例 #1
0
ファイル: Dropout.cs プロジェクト: quakemaster/MxNet.Sharp
        public override KerasSymbol[] Invoke(KerasSymbol[] inputs, FuncArgs kwargs = null)
        {
            List <KerasSymbol> result = new List <KerasSymbol>();
            bool training             = kwargs.Get <bool>("training");

            foreach (var input in inputs)
            {
                Func <KerasSymbol> dropped_inputs = () => {
                    return(K.Dropout(input, this.rate, noise_shape, seed: this.seed));
                };

                if ((0 < this.rate) && (this.rate < 1.0))
                {
                    var noise_shape = this.GetNoiseShape(input);
                    result.Add(K.InTrainPhase(dropped_inputs, input, training: training));
                }
            }

            return(result.ToArray());
        }