mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Summary:
After this, all combinations of {String frontend, Python AST Frontend}{Python 3-style type annotations, MyPy-style type comments}{Script method, Script function} should properly accept type annotations.
Possible TODOs:
- Clean up the functions marked HACK
- Clean up the Subscript tree-view to better match the Python AST versions
- Can we use this for Python functions? That's the only place annotations.get_signature() is still needed
Pull Request resolved: https://github.com/pytorch/pytorch/pull/10279
Differential Revision: D9319726
Pulled By: jamesr66a
fbshipit-source-id: b13f7d4f066b0283d4fc1421a1abb9305c3b28fa
74 lines
1.5 KiB
Plaintext
74 lines
1.5 KiB
Plaintext
(def
|
|
(ident fn)
|
|
(decl
|
|
(list
|
|
(param
|
|
(ident x)
|
|
(variable (ident Tensor)))
|
|
(param
|
|
(ident y)
|
|
(variable (ident Tensor)))
|
|
(param
|
|
(ident z)
|
|
(variable (ident Tensor))))
|
|
(option))
|
|
(list
|
|
(assign
|
|
(list (variable (ident q)))
|
|
(=)
|
|
(None))
|
|
(assign
|
|
(list (variable (ident q)))
|
|
(=)
|
|
(-
|
|
(+
|
|
(variable (ident x))
|
|
(variable (ident y)))
|
|
(apply
|
|
(.
|
|
(variable (ident z))
|
|
(ident sigmoid))
|
|
(list)
|
|
(list))))
|
|
(expression statement
|
|
(list
|
|
(apply
|
|
(variable (ident print))
|
|
(list (variable (ident q)))
|
|
(list))))
|
|
(assign
|
|
(list (variable (ident w)))
|
|
(=)
|
|
(unary minus
|
|
(variable (ident z))))
|
|
(if
|
|
(and
|
|
(and
|
|
(not (variable (ident x)))
|
|
(not (variable (ident y))))
|
|
(variable (ident z)))
|
|
(list
|
|
(assign
|
|
(list (variable (ident m)))
|
|
(=)
|
|
(if
|
|
(not (variable (ident z)))
|
|
(variable (ident x))
|
|
(variable (ident y)))))
|
|
(list))
|
|
(while
|
|
(and
|
|
(<
|
|
(variable (ident x))
|
|
(variable (ident y)))
|
|
(>
|
|
(variable (ident y))
|
|
(variable (ident z))))
|
|
(list
|
|
(assign
|
|
(list (variable (ident q)))
|
|
(=)
|
|
(variable (ident x)))))
|
|
(return
|
|
(list (variable (ident x))))))
|