示例#1
0
        public void Infer(Requantize layer, RequantizeLayerArgument argument, InferenceContext context)
        {
            var inputAlloc  = context.MainMemoryMap[layer.Input.Connection.From];
            var outputAlloc = context.MainMemoryMap[layer.Output];

            argument.Flags = K210LayerFlags.MainMemoryOutput;
            argument.MainMemoryInputAddress  = inputAlloc.GetAddress();
            argument.MainMemoryOutputAddress = outputAlloc.GetAddress();
        }
示例#2
0
        public void Forward(RequantizeLayerArgument argument, ForwardContext context)
        {
            var src  = context.GetMainRamAt((int)argument.MainMemoryInputAddress);
            var dest = context.GetMainRamAt((int)argument.MainMemoryOutputAddress);

            for (int i = 0; i < argument.Count; i++)
            {
                dest[i] = argument.Table[src[i]];
            }
        }
示例#3
0
        public RequantizeLayerArgument DeserializeBin(int offset, K210BinDeserializeContext context)
        {
            var sr       = context.GetReaderAt(offset);
            var argument = new RequantizeLayerArgument
            {
                Flags = sr.Read <K210LayerFlags>(),
                MainMemoryInputAddress  = sr.Read <uint>(),
                MainMemoryOutputAddress = sr.Read <uint>(),
                Count = sr.Read <uint>(),
                Table = sr.ReadArray <byte>(256)
            };

            return(argument);
        }