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

            foreach (var input in inputs)
            {
                var maskValue   = K.Constant(mask_value, input.DType, input.Shape);
                var output_mask = K.Any(K.NotEqual(input, maskValue), axis: -1);
                result.Add(output_mask);
            }

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

            foreach (var input in inputs)
            {
                var maskValue    = K.Constant(mask_value, input.DType, input.Shape);
                var boolean_mask = K.Any(K.NotEqual(input, maskValue), axis: -1, keepdims: true);
                result.Add(input * K.Cast(boolean_mask, K.DataType(input)));
            }

            return(result.ToArray());
        }