Solved by ptrblck in post #2 
              
              
                I’m not sure if it’s the indexing or rather the rhs of the assignment, since the error says: 

Expected a value of type ‘Tensor’ for argument ‘values’ but instead found type ‘int’. 

This seems to work: 
@torch.jit.script 
def f(): 
    t = torch.tensor([0.])
    t[t!=t] = torch.tensor(7.)
    retur…