It seems taht the offset and v_length calculation combined with the slicing of theta is wrong.
As you can see here:
torch.randn([10])[10:20].view(48)
> RuntimeError: shape '[48]' is invalid for input of size 0

you are most likely creating an empty tensor in theta[offset: offset+v_length] while the view operation expects to be used on 48 values.