Yes, that problem affected both our Generic containers (Dict and List) when the element type was TensorType. After the fix GenericList is also initialized with c10::unshapedType(firstElement) which should fix the problem like ‘List[Tensor] is not List[Tensor]’

  
      github.com
  
  
    pytorch/pytorch/blob/master/android/pytorch_android/src/main/cpp/pytorch_jni_common.cpp#L509 3

              facebook::jni::JArrayClass<JIValue::javaobject>::javaobject()>(
              "toList");
  auto jarray = jMethodGetList(jivalue);
  size_t n = jarray->size();
  if (n == 0) {
    return at::IValue{c10::impl::GenericList(c10::TensorType::get())};
  }


  auto jivalue_first_element = jarray->getElement(0);
  auto first_element = JIValue::JIValueToAtIValue(jivalue_first_element);
  c10::impl::GenericList list{c10::unshapedType(first_element.type())};
  list.reserve(n);
  list.push_back(first_element);
  for (auto i = 1; i < n; ++i) {
    auto jivalue_element = jarray->getElement(i);
    auto element = JIValue::JIValueToAtIValue(jivalue_element);
    list.push_back(element);
  }
  return at::IValue{list};
} else if (JIValue::kTypeCodeDictStringKey == typeCode) {
  static const auto jMethodGetDictStringKey =