mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Summary: Action following https://github.com/pytorch/pytorch/issues/66232 Pull Request resolved: https://github.com/pytorch/pytorch/pull/67552 Reviewed By: jbschlosser Differential Revision: D32028248 Pulled By: janeyx99 fbshipit-source-id: a006f7026288b7126dba58b31cac28e10ce0fed6
16 lines
412 B
Python
16 lines
412 B
Python
# Owner(s): ["module: unknown"]
|
|
|
|
import argparse
|
|
import torch
|
|
|
|
if __name__ == '__main__':
|
|
parser = argparse.ArgumentParser()
|
|
|
|
# Required args. Raises error if they aren't passed.
|
|
parser.add_argument('--foo', help='foo', required=True)
|
|
parser.add_argument('--bar', help='bar', required=True)
|
|
_ = parser.parse_args()
|
|
|
|
x = torch.ones((3, 3), requires_grad=True)
|
|
(3 * x).sum().backward()
|