Hello !
My question is very simple: The first 3 lines of my forward are these:
def forward(self, x):
h, w = x.shape[2:]
max_offset = max(h, w) / 4.
Everything works fine during training and evaluation. When I want to export my model in onnx format I get this warning :
TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
max_offset = max(h, w) / 4.
I understand that the max_offset value will be calculated once during export and then stored as a constant value. But how can I make the value dynamic?
I’ve been stuck on this point for hours…
Thanks in advance