public void Infer(QuantizedResizeNearestNeighbor layer, QuantizedResizeNearestNeighborLayerArgument argument, InferenceContext context)
        {
            var inputAlloc  = context.MainMemoryMap[layer.Input.Connection.From];
            var outputAlloc = context.MainMemoryMap[layer.Output];

            argument.MainMemoryInputAddress  = inputAlloc.GetAddress();
            argument.MainMemoryOutputAddress = outputAlloc.GetAddress();
        }
 public QuantizedResizeNearestNeighborLayerArgument Convert(QuantizedResizeNearestNeighbor layer, ConvertContext context)
 {
     return(new QuantizedResizeNearestNeighborLayerArgument
     {
         InputWidth = (uint)layer.Input.Dimensions[3],
         InputHeight = (uint)layer.Input.Dimensions[2],
         Channels = (uint)layer.Input.Dimensions[1],
         OutputWidth = (uint)layer.Output.Dimensions[3],
         OutputHeight = (uint)layer.Output.Dimensions[2],
         AlignCorners = layer.AlignCorners ? 1 : 0
     });
 }
Exemplo n.º 3
0
        public override void Process(TransformContext context)
        {
            var resize = (ResizeNearestNeighbor)context.MatchedLayers[0];
            var input  = resize.Input.Connection.From.Owner.InputConnectors[0].Connection.From;
            var output = resize.Output;

            var quantResize = new QuantizedResizeNearestNeighbor(resize.Input.Dimensions, resize.Output.Dimensions[3], resize.Output.Dimensions[2], resize.AlignCorners);
            var dequant     = new Dequantize(quantResize.Output.Dimensions);

            quantResize.Input.SetConnection(input);
            dequant.Input.SetConnection(quantResize.Output);

            var oldOuts = output.Connections.Select(o => o.To).ToList();

            foreach (var oldOut in oldOuts)
            {
                oldOut.SetConnection(dequant.Output);
            }
        }