Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Module.load is giving error "CppException: false CHECK FAILED at aten/src/ATen/Functions.h " #48

Open
siju-samuel opened this issue Dec 30, 2019 · 0 comments

Comments

@siju-samuel
Copy link

siju-samuel commented Dec 30, 2019

Need help
Module.load is giving error "CppException: false CHECK FAILED at aten/src/ATen/Functions.h "
What is the reason? Even i can reproduce this issue with simple convolution layer.

2019-12-30 08:51:20.487 28171-28328/org.pytorch.demo E/PyTorchDemo: Error during image analysis com.facebook.jni.CppException: false CHECK FAILED at aten/src/ATen/Functions.h (empty at aten/src/ATen/Functions.h:3535) (no backtrace available) at org.pytorch.Module$NativePeer.initHybrid(Native Method) at org.pytorch.Module$NativePeer.<init>(Module.java:70) at org.pytorch.Module.<init>(Module.java:25) at org.pytorch.Module.load(Module.java:21) at org.pytorch.demo.vision.ImageClassificationActivity.analyzeImage(ImageClassificationActivity.java:166) at org.pytorch.demo.vision.ImageClassificationActivity.analyzeImage(ImageClassificationActivity.java:31) at org.pytorch.demo.vision.AbstractCameraXActivity.lambda$setupCameraX$2$AbstractCameraXActivity(AbstractCameraXActivity.java:90) at org.pytorch.demo.vision.-$$Lambda$AbstractCameraXActivity$t0OjLr-l_M0-_0_dUqVE4yqEYnE.analyze(Unknown Source:2) at androidx.camera.core.ImageAnalysisAbstractAnalyzer.analyzeImage(ImageAnalysisAbstractAnalyzer.java:57) at androidx.camera.core.ImageAnalysisNonBlockingAnalyzer$1.run(ImageAnalysisNonBlockingAnalyzer.java:135) at android.os.Handler.handleCallback(Handler.java:907) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:216) at android.os.HandlerThread.run(HandlerThread.java:65)

The compiled android module is attached below.

android_torch_test.zip

Script to reproduce this issue:

`
import torch
import torch.nn as nn
import torchvision
from torchsummary import summary

class MyBlock(nn.Module):
def init(self, ninput, noutput):
super().init()
self.conv = nn.Conv2d(ninput, noutput - ninput, (3, 3), stride=2, padding=1, bias=True)
def forward(self, input):
return self.conv(input)

model = MyBlock(3,16).cuda()
model.eval()

print("-----MODEL---------")
print(model)

example_input = torch.rand(1, 3, 512, 1024).cuda()
print("Input Shape = ", example_input.shape)
print("-----MODEL SUMMARY---------")
print(summary(model, example_input.shape[1:]))

traced_script_module = torch.jit.trace(model, example_input)
traced_script_module.save("android_torch_test.pt")

`

Pytorch Version
image

I tried changing filenames of "android_torch_test.pt" to many, but upon Module.load, im getting model load error.
But if i load any models present in assets folder, its loading fine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant