finn-base
finn-base copied to clipboard
Can't unset tensor shape, with set_tensor_shape
It is currently not possible to easily remove the shape from a given tensor.
The attached .zip file contains an QONNX model, which has unset tensors: CNV_2W2A.zip
Running the following:
from finn.core.modelwrapper import ModelWrapper
model = ModelWrapper("CNV_2W2A.onnx")
print(model.get_tensor_shape("55"))
model.set_tensor_shape("55", None)
print(model.get_tensor_shape("55"))
produces:
None
[]
When it should produce:
None
None
Unsetting the tensor shape is in particular useful, when one has changed some up-stream tensor and wants to run shape inference again for the rest of the down-stream tensors. Because as long as the down-stream tensors have wrong or out-dated shapes the shape inference will always fail.
This would require changes to the set_tensor_shape
function here: https://github.com/Xilinx/finn-base/blob/92f00196f931b63b08b304c8acac49b078c9c741/src/finn/core/modelwrapper.py#L188
Such that the function will not append a new tensor_value_info
, when the argument tensor_shape
is None
.