WARNING:root:Untyped Tensor found, assume it is float

When I run the example code in from pytorch , at line

mod, params = relay.frontend.from_pytorch(scripted_model, shape_dict)

there are multiple lines of warning

WARNING:root:Untyped Tensor found, assume it is float

Does this warning matters and how to solve this? Thanks

1 Like

Yes, unless you really have integer tensors somewhere, which is highly unlikely, you can ignore this warning.

This warning is added for when converting from torch models jitted by torch.jit.script(...). In script, there is no way to tell the type of input tensors, so we just assume it is float tensors. If you use torch.jit.trace(), torch knows the type of input tensors, so there is no problem.

See

1 Like

I am obtaining the same warnings in the same tutorial. Only exception is that now it is assuming “float32” instead of “float”.

Is there any way to deactivate these warnings? Executing this tutorial produces an excessive amount of warnings that pollutes the output.

Thanks.

This is a standard python warning, so you can turn it off by adding

import logging
logging.basicConfig(level=logging.ERROR)

But there are lots of other warning (free variables related) coming from c++. For now, the only way to turn them off is manually commenting out the log.