-
Notifications
You must be signed in to change notification settings - Fork 336
Expand file tree
/
Copy pathtest.py
More file actions
35 lines (25 loc) · 1.19 KB
/
Copy pathtest.py
File metadata and controls
35 lines (25 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python
# Copyright (c) Microsoft Corporation. All rights reserved.
import argparse
import subprocess
import os
import pathlib
import torch
import torch_directml
import sys
classification_folder = str(os.path.join(pathlib.Path(__file__).parent.parent.resolve(), 'classification'))
# insert at 1, 0 is the script path (or '' in REPL)
sys.path.insert(1, classification_folder)
from test_classification import main as test
def main():
parser = argparse.ArgumentParser(__doc__)
parser.add_argument("--path", type=str, default="cifar-10-python", help="Path to cifar dataset.")
parser.add_argument('--batch_size', type=int, default=32, metavar='N', help='Batch size to train with.')
parser.add_argument('--device', type=str, default='dml', help='The device to use for training.')
parser.add_argument('--trace', type=bool, default=False, help='Trace performance.')
args = parser.parse_args()
batch_size = 1 if args.trace else args.batch_size
device = torch_directml.device(torch_directml.default_device()) if args.device == 'dml' else torch.device(args.device)
test(args.path, batch_size, device, 'squeezenet1_1', args.trace)
if __name__ == "__main__":
main()