Skip to content

"type id is VariableTensorId" runtime error for some mobile models #26764

@ljk53

Description

@ljk53

Summary

Since PR #25597 landed some models started failing to run with mobile build with the following error:

type id is VariableTensorId
terminate called after throwing an instance of 'std::runtime_error'
  what():  false CHECK FAILED at ../c10/core/Backend.h

For the specific model the problem can be workaround if we use AutoGradMode guard + AutoNonVariableTypeMode guard around torch::jit::load().

But setting AutoNonVariableTypeMode guard before torch::jit::load() will cause some other models to fail:

terminating with uncaught exception of type
c10::Error: !v.defined() || v.is_variable()
INTERNAL ASSERT FAILED at../torch/csrc/jit/ir.h (t_ at ../torch/csrc/jit/ir.h:718)

We need find root cause and figure out a more robust solution to address both cases.

Edit 1:
PR #25597 is not the root cause. I analyzed root cause and proposed a solution on #26868 .

Edit 2:
We decided to solve this problem with #26908 + #26868.

Edit 3:
In 1.3 release we solve this problem with #27274 + #26868, we replaced #26908 with #27274 due to perf regression.

Edit 4:
We need add guard to TensorMethods.h as revealed by pytorch/android-demo-app#19.

Metadata

Metadata

Labels

oncall: mobileRelated to mobile support, including iOS and AndroidtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions