Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,30 @@
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Arrays;
import org.pytorch.executorch.Module;

public class BenchmarkActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
String modelPath = intent.getStringExtra("model_path");
File modelDir = new File(intent.getStringExtra("model_dir"));
File model =
Arrays.stream(modelDir.listFiles())
.filter(file -> file.getName().endsWith(".pte"))
.findFirst()
.get();

int numIter = intent.getIntExtra("num_iter", 10);

// TODO: Format the string with a parsable format
StringBuilder resultText = new StringBuilder();

Module module = Module.load(modelPath);
Module module = Module.load(model.getPath());
for (int i = 0; i < numIter; i++) {
long start = System.currentTimeMillis();
module.forward();
Expand Down
Loading