jwlee
January 18, 2020, 8:36am
1
Hello, everyone.
I have a question regarding deploy_vision_on_vta.py.
The code states that it offloads ResNet-18 part from [nn.max_pool2d] to [nn.global_avg_pool2d].
I want to how the 1st convolution before nn.max_pool2d is processed in VTA.
Thanks,
Jake
aca88
January 20, 2020, 7:04am
2
It isn’t.
AFAIK the 1st convolution will be performed on the Arm core which is in the FPGA fabric part of the Pynq target but not part of the FPGA fabric which is where the VTA is actually implemented.
1 Like
jwlee
January 21, 2020, 7:45am
3
Thanks for responding.
Yes, you are right.
What I meant was how 1st convolution was done on the pynq board.
I wrote “VTA” instead of “pynq”, my bad.
Can you tell me the source code folder that helps to understand offloading part?
Thanks,
Jake
aca88
January 21, 2020, 10:40am
4
No problem.
I am not really up-to-date with the latest VTA codebase but taking an educated guess (and leaving some of the details for you to find) you can start here
if target.device_name == "vta":
# Perform quantization in Relay
# Note: We set opt_level to 3 in order to fold batch norm
with relay.build_config(opt_level=3):
with relay.quantize.qconfig(global_scale=8.0,
skip_conv_layers=[0]):
mod = relay.quantize.quantize(mod, params=params)
# Perform graph packing and constant folding for VTA target
assert env.BLOCK_IN == env.BLOCK_OUT
relay_prog = graph_pack(
mod["main"],
env.BATCH,
env.BLOCK_OUT,
env.WGT_WIDTH,
start_name=pack_dict[model][0],
stop_name=pack_dict[model][1])
else:
relay_prog = mod["main"]
# Compile Relay program with AlterOpLayout disabled