Solved by IvanKobzarev in post #4 
              
              
                Hello @zetyquickly, 
Thanks one more time for this finding. 
It happened as in jni tensorType was deduced from the first entry value of dictionary, including shape, requires_grad etc. 
While torchscript function did not have it. Dict is not covariant, so the subtype check required equal KeyType(str)…