Skip to content

Commit ca6995b

Browse files
kirklandsignfacebook-github-bot
authored andcommitted
java instrumentation test with MV2 (#2029)
Summary: Pull Request resolved: #2029 A simple test to validate the E2E workflow for Java library (load jni, load module, execute) Reviewed By: mcr229 Differential Revision: D53953813 fbshipit-source-id: 17f401da0b274eeaf66af72bd90bcb71139b1d73
1 parent 1186129 commit ca6995b

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

examples/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"llama2": ("llama2", "Llama2Model"),
1919
"mobilebert": ("mobilebert", "MobileBertModelExample"),
2020
"mv2": ("mobilenet_v2", "MV2Model"),
21+
"mv2_untrained": ("mobilenet_v2", "MV2UntrainedModel"),
2122
"mv3": ("mobilenet_v3", "MV3Model"),
2223
"vit": ("torchvision_vit", "TorchVisionViTModel"),
2324
"w2l": ("wav2letter", "Wav2LetterModel"),

examples/models/mobilenet_v2/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
# This source code is licensed under the BSD-style license found in the
55
# LICENSE file in the root directory of this source tree.
66

7-
from .model import MV2Model
7+
from .model import MV2Model, MV2UntrainedModel
88

99
__all__ = [
1010
MV2Model,
11+
MV2UntrainedModel,
1112
]

examples/models/mobilenet_v2/model.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,17 @@ def get_eager_model(self) -> torch.nn.Module:
2929
def get_example_inputs(self):
3030
tensor_size = (1, 3, 224, 224)
3131
return (torch.randn(tensor_size),)
32+
33+
34+
class MV2UntrainedModel(EagerModelBase):
35+
def __init__(self):
36+
pass
37+
38+
def get_eager_model(self) -> torch.nn.Module:
39+
# pyre-ignore
40+
mv2 = mobilenet_v2()
41+
return mv2
42+
43+
def get_example_inputs(self):
44+
tensor_size = (1, 3, 224, 224)
45+
return (torch.randn(tensor_size),)

examples/xnnpack/aot_compiler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
required=False,
5757
help="Generate and save an ETRecord to the given file location",
5858
)
59+
parser.add_argument("-o", "--output_dir", default=".", help="output directory")
5960

6061
args = parser.parse_args()
6162

@@ -110,4 +111,4 @@
110111

111112
quant_tag = "q8" if args.quantize else "fp32"
112113
model_name = f"{args.model_name}_xnnpack_{quant_tag}"
113-
save_pte_program(exec_prog.buffer, model_name)
114+
save_pte_program(exec_prog.buffer, model_name, args.output_dir)

0 commit comments

Comments
 (0)