mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 00:21:07 +01:00
Summary: Previously, we did not distinguish between `a = b` (simple assignment), and `a, = b` (tuple destructuring of a singleton tuple). The second case would fail in the string frontend, and would not unpack in the python frontend. This patch fixes both issues and also cleans up the error reporting for unexpected expressions on the LHS. Will likely conflict with #13486 Pull Request resolved: https://github.com/pytorch/pytorch/pull/13656 Differential Revision: D12964566 Pulled By: zdevito fbshipit-source-id: 992b19e5068aef59a78cd23cb0e59a9eeb7755d1
71 lines
1.5 KiB
Plaintext
71 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
|
|
(variable (ident q))
|
|
(None))
|
|
(assign
|
|
(variable (ident q))
|
|
(-
|
|
(+
|
|
(variable (ident x))
|
|
(variable (ident y)))
|
|
(apply
|
|
(.
|
|
(variable (ident z))
|
|
(ident sigmoid))
|
|
(list)
|
|
(list))))
|
|
(expression statement
|
|
(apply
|
|
(variable (ident print))
|
|
(list (variable (ident q)))
|
|
(list)))
|
|
(assign
|
|
(variable (ident w))
|
|
(unary minus
|
|
(variable (ident z))))
|
|
(if
|
|
(and
|
|
(and
|
|
(not (variable (ident x)))
|
|
(not (variable (ident y))))
|
|
(variable (ident z)))
|
|
(list
|
|
(assign
|
|
(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
|
|
(variable (ident q))
|
|
(variable (ident x)))))
|
|
(assert
|
|
(eq (const 1) (const 1))
|
|
(option (string_literal hello)))
|
|
(return
|
|
(list (variable (ident x))))))
|