assetFilePath() — pytorch Function Reference
Architecture documentation for the assetFilePath() function in PytorchInstrumentedTests.java from the pytorch codebase.
Entity Profile
Dependency Diagram
graph TD 0d9aa5f7_e5cd_2999_250e_3ab1e000372b["assetFilePath()"] 04eeb575_90bf_f54c_d27a_3bbb8e24eacd["loadModel()"] 04eeb575_90bf_f54c_d27a_3bbb8e24eacd -->|calls| 0d9aa5f7_e5cd_2999_250e_3ab1e000372b style 0d9aa5f7_e5cd_2999_250e_3ab1e000372b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
android/pytorch_android/src/androidTest/java/org/pytorch/PytorchInstrumentedTests.java lines 21–41
private String assetFilePath(String assetName) throws IOException {
final Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
File file = new File(appContext.getFilesDir(), assetName);
if (file.exists() && file.length() > 0) {
return file.getAbsolutePath();
}
try (InputStream is = appContext.getAssets().open(assetName)) {
try (OutputStream os = new FileOutputStream(file)) {
byte[] buffer = new byte[4 * 1024];
int read;
while ((read = is.read(buffer)) != -1) {
os.write(buffer, 0, read);
}
os.flush();
}
return file.getAbsolutePath();
} catch (IOException e) {
throw e;
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does assetFilePath() do?
assetFilePath() is a function in the pytorch codebase.
What calls assetFilePath()?
assetFilePath() is called by 1 function(s): loadModel.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free