Example #1
0
        public void Forward(ConcatenationLayerArgument argument, ForwardContext context)
        {
            var dest = context.GetMainRamAt((int)argument.MainMemoryOutputAddress);

            foreach (var input in argument.InputsMainMemory)
            {
                var src = context.GetMainRamAt((int)input.Start, (int)input.Size);
                src.CopyTo(dest);
                dest = dest.Slice((int)input.Size);
            }
        }
Example #2
0
        public ConcatenationLayerArgument DeserializeBin(int offset, K210BinDeserializeContext context)
        {
            var sr       = context.GetReaderAt(offset);
            var argument = new ConcatenationLayerArgument
            {
                Flags = sr.Read <K210LayerFlags>(),
                MainMemoryOutputAddress = sr.Read <uint>(),
                InputCount = sr.Read <uint>()
            };

            argument.InputsMainMemory = sr.ReadArray <MemoryRange>((int)argument.InputCount);
            return(argument);
        }
Example #3
0
        public void Infer(Concatenation layer, ConcatenationLayerArgument argument, InferenceContext context)
        {
            var outputAlloc = context.MainMemoryMap[layer.Output];

            argument.Flags = K210LayerFlags.MainMemoryOutput;
            argument.MainMemoryOutputAddress = outputAlloc.GetAddress();
            argument.InputsMainMemory        = (from i in layer.Inputs
                                                let a = context.MainMemoryMap[i.Connection.From]
                                                        select new MemoryRange
            {
                Start = a.GetAddress(),
                Size = a.Size
            }).ToList();
        }