Beispiel #1
0
        public void Forward(K210UploadLayerArgument argument, ForwardContext context)
        {
            var src  = context.GetMainRamAt((int)argument.MainMemoryInputAddress);
            var dest = context.GetKpuRamAt((int)argument.KPUMemoryOutputAddress);

            K210Helper.KpuUpload(dest, src, (int)argument.Width, (int)argument.Height, (int)argument.Channels);
        }
Beispiel #2
0
        public void Infer(K210Upload layer, K210UploadLayerArgument argument, InferenceContext context)
        {
            var inputAlloc  = context.MainMemoryMap[layer.Input.Connection.From];
            var outputAlloc = context.KPUMemoryMap[layer.Output];

            argument.MainMemoryInputAddress = inputAlloc.GetAddress();
            argument.KPUMemoryOutputAddress = outputAlloc.GetAddress();
        }
Beispiel #3
0
        public K210UploadLayerArgument DeserializeBin(int offset, K210BinDeserializeContext context)
        {
            var sr       = context.GetReaderAt(offset);
            var argument = new K210UploadLayerArgument
            {
                Flags = sr.Read <K210LayerFlags>(),
                MainMemoryInputAddress = sr.Read <uint>(),
                KPUMemoryOutputAddress = sr.Read <uint>(),
                Width    = sr.Read <uint>(),
                Height   = sr.Read <uint>(),
                Channels = sr.Read <uint>()
            };

            return(argument);
        }