public void Infer(K210RemovePadding layer, K210RemovePaddingLayerArgument 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(); }
public void Forward(K210RemovePaddingLayerArgument argument, ForwardContext context) { var src = context.GetMainRamAt((int)argument.MainMemoryInputAddress); var dest = context.GetMainRamAt((int)argument.MainMemoryOutputAddress); for (int oc = 0; oc < argument.Channels; oc++) { dest[oc] = src[oc * 16]; } }
public K210RemovePaddingLayerArgument DeserializeBin(int offset, K210BinDeserializeContext context) { var sr = context.GetReaderAt(offset); var argument = new K210RemovePaddingLayerArgument { Flags = sr.Read <K210LayerFlags>(), MainMemoryInputAddress = sr.Read <uint>(), MainMemoryOutputAddress = sr.Read <uint>(), Channels = sr.Read <uint>() }; return(argument); }