Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public void Forward(K210AddPaddingLayerArgument argument, ForwardContext context)
        {
            var src  = context.GetMainRamAt((int)argument.MainMemoryInputAddress);
            var dest = context.GetKpuRamAt((int)argument.KPUMemoryOutputAddress);

            var height = 4;

            (var groups, var rowLength, var rowPadding) = (4, 1, 16);
            int srcIdx = 0;

            for (int oc = 0; oc < argument.Channels; oc++)
            {
                var channel_origin = oc / groups * rowLength * height * 64 + oc % groups * rowPadding;
                for (int y = 0; y < 1; y++)
                {
                    var y_origin = channel_origin + y * rowLength * 64;
                    for (int x = 0; x < 1; x++)
                    {
                        dest[y_origin + x] = src[srcIdx++];
                    }
                }
            }
        }