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(); }
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]]; } }
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); }