mirror of
https://github.com/zebrajr/pytorch.git
synced 2026-01-15 12:15:51 +00:00
60 lines
1.2 KiB
Plaintext
60 lines
1.2 KiB
Plaintext
(def
|
|
(ident fn)
|
|
(list
|
|
(param (ident x) (tensor_type))
|
|
(param (ident y) (tensor_type))
|
|
(param (ident z) (tensor_type)))
|
|
(list
|
|
(assign
|
|
(list (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
|
|
(list (ident w))
|
|
(=)
|
|
(- (variable (ident z))))
|
|
(if
|
|
(and
|
|
(and
|
|
(not (variable (ident x)))
|
|
(not (variable (ident y))))
|
|
(variable (ident z)))
|
|
(list
|
|
(assign
|
|
(list (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 (ident q))
|
|
(=)
|
|
(variable (ident x)))))
|
|
(return
|
|
(list (variable (ident x))))))
|