You need to sign in or sign up before continuing.
未验证 提交 3a8bef1d 编写于 作者: L liym27 提交者: GitHub

[Dynamic-to-Static] Refine 2.0rc assign: paddle.nn.functional.assign (#27650)

上级 20fb01fb
......@@ -116,14 +116,14 @@ def is_to_variable(node):
def to_assign_node(node):
# Transform dygraph api `fluid.dygraph.to_variable` alias `paddle.to_tensor` to static api `fluid.layers.assign`.
# Transform dygraph api `fluid.dygraph.to_variable` alias `paddle.to_tensor` to static api `paddle.nn.functional.assign`.
# NOTE:
# 1. Api `to_variable` supports data type {float16, float32, float64, int16, int32, int64, uint8, uint16},
# but api `assign` only supports {float32, float64, int32, int64, bool};
# 2. If the input of api `assign` is numpy.ndarray, its size cannot be greater than 1024 * 1024.
assert isinstance(node, gast.Call)
assign_api = gast.parse('fluid.layers.assign').body[0].value
assign_api = gast.parse('paddle.nn.functional.assign').body[0].value
node.func = assign_api
if node.args:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册