Can not create a tensor in torchscript loaded on mobile

I tried to create tensor follow below code:

...
punc_character_torch = torch.tensor([191, 193, 194, 195, 196], dtype=token.dtype, device=device)

Convert this code to Torchscript and run it on my pc normally. But when i loaded torchscript to mobile, i got below issue:

2019-12-06 10:24:21.652 15260-15260/org.pytorch.demo E/AndroidRuntime: FATAL EXCEPTION: main
    Process: org.pytorch.demo, PID: 15260
    java.lang.RuntimeException: is_variable() || !defined() CHECK FAILED at ../torch/csrc/autograd/variable.h
    The above operation failed in interpreter, with the following stack trace:
    at code/__torch__/torchscript/Model.py:1686:27
          ops.prim.RaiseException("Exception")
        if torch.gt(alpha, 0):
          pass
        else:
          ops.prim.RaiseException("Exception")
        device = ops.prim.device(encoder_outputs)
        out_dtype = ops.prim.dtype(encoder_outputs)
        encoder_output_hidden_size = torch.size(encoder_outputs, -1)
        max_encoder_length = torch.size(encoder_outputs, 1)
        punc_character_torch = torch.tensor([191, 193, 194, 195, 196], dtype=ops.prim.dtype(token), device=device, requires_grad=False)
                               ~~~~~~~~~~~~ <--- HERE

It seem that torchscript still does not support create tensor on mobile device. Any idea to tackle this problem?

Can you try this with the latest nightly (1.4.0-SNAPSHOT)? Instructions are in the first half of this post: [Android] Something's went wrong with pytorch_android-1.4.0-SNAPSHOT

This part of the code was refactored and the issue should either be fixed or at least have a clearer error message.