Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Can't unset tensor shape, with set_tensor_shape #40

Open
heborras opened this issue Aug 10, 2021 · 0 comments
Open

Can't unset tensor shape, with set_tensor_shape #40

heborras opened this issue Aug 10, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@heborras
Copy link
Contributor

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:

def set_tensor_datatype(self, tensor_name, datatype):

Such that the function will not append a new tensor_value_info, when the argument tensor_shape is None.

@heborras heborras added the bug Something isn't working label Aug 10, 2021
@heborras heborras self-assigned this Aug 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant