示例#1
0
        public override KerasSymbol[] Invoke(KerasSymbol[] inputs, FuncArgs kwargs = null)
        {
            List <KerasSymbol> result = new List <KerasSymbol>();

            foreach (var input in inputs)
            {
                if (this.data_format == "channels_first")
                {
                    // Ensure works for any dim
                    var permutation = new List <int> {
                        0
                    };
                    permutation.AddRange((from i in Enumerable.Range(2, K.NDim(input) - 2)
                                          select i).ToList());
                    permutation.Add(1);
                    result.Add(K.PermuteDimensions(input, new Shape(permutation)));
                }
                else
                {
                    result.Add(K.BatchFlatten(input));
                }
            }

            return(result.ToArray());
        }