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

Can't unset tensor shape, with set_tensor_shape #40

@heborras

Description

@heborras

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions