Caffe2 - Python API
A deep learning, cross platform ML framework
test_args.py
1 import argparse
2 import torch
3 
4 if __name__ == '__main__':
5  parser = argparse.ArgumentParser()
6 
7  # Required args. Raises error if they aren't passed.
8  parser.add_argument('--foo', help='foo', required=True)
9  parser.add_argument('--bar', help='bar', required=True)
10  _ = parser.parse_args()
11 
12  x = torch.ones((3, 3), requires_grad=True)
13  (3 * x).sum().backward()