You are currently trying to script a tensor in:
traced_cell=torch.jit.script(aux)

so I assume you want to pass model instead to the method?
Try to narrow down the issue, as your current code contains more than 700 lines of code.