As you’ve already explained, the first error is used if numpy arrays are used instead of tensors.
The second one is raised, if your forward pass is data-dependent and could change for different inputs.
Tracing a model would record all operations for the provided input and would not allow to execute conditions inside the model etc. If you want to use conditions, loops, etc. (as is suggested by the error message), you could torch.jit.script the model instead.