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) and ValueType(TensorType0).
TensorType’s of function argument and provided value were different and typecheck failed.
Error message did not include that additional information about TensorType.
This problem was fixed on android-jni level in commit:

  
      github.com/pytorch/pytorch
  
  
    
  
    
  

  
    
      GenericDict/List type use unshapedType() (#30428) 9
    

    
      
        committed 
        
          
        
        Nov 26, 2019
      
      

      
        
          
          IvanKobzarev
        
        
      

      
        
          +5
          -6
        
      
    

  



  
    Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30428
Reported issue https://discuss.pytorch.org/t/incomprehensible-behaviour/61710
Steps to reproduce:
```
class WrapRPN(nn.Module):
 def __init__(self):
 super().__init__()
 def forward(self, features):
 # type: (Dict[str, Tensor]) -> int
...
  


  
  
    
    
  
  


It was merged in master recently.
Separate issue for more detailed error messages in TensorType checks.

  
      github.com/pytorch/pytorch
  
  
    
  
	  
  

  
    
      More detailed information about TensorType in error messages 4
    

    
      
        opened 
        
          
        
        Nov 25, 2019
      
      


      
        
          
          IvanKobzarev
        
      
    
  



  🚀 Feature
More detailed information about TensorType, including TensorType specifiers as shape, strides, req_grad etc. in error messages
Motivation
Reported issue https://discuss.pytorch.org/t/incomprehensible-behaviour/61710
Error message is...



    enhancement
    triaged


  
  
    
    
  
  


Android nightlies (snapshots) are already republished with this fix, the error should not happen with them.
To use nightlies (to force refresh dependencies gradle has argument --refresh-dependencies)
repositories {
    maven {
        url "https://oss.sonatype.org/content/repositories/snapshots"
    }
}

dependencies {
    ...
    implementation 'org.pytorch:pytorch_android:1.4.0-SNAPSHOT'
    implementation 'org.pytorch:pytorch_android_torchvision:1.4.0-SNAPSHOT'
    ...
}