未验证 提交 a33f0814 编写于 作者: T Tao Luo 提交者: GitHub

update np.float16 usage (#4851)

上级 a00c8afb
......@@ -30,7 +30,7 @@ def cast_fp32_to_fp16(exe, main_program):
param_t = fluid.global_scope().find_var(param.name).get_tensor()
data = np.array(param_t)
if param.name.find("layer_norm") == -1:
param_t.set(np.float16(data).view(np.uint16), exe.place)
param_t.set(np.float16(data), exe.place)
master_param_var = fluid.global_scope().find_var(param.name +
".master")
if master_param_var is not None:
......
......@@ -32,7 +32,7 @@ def cast_fp32_to_fp16(exe, main_program):
if param.name.find("layer_norm") == -1 and param.name.find(
"embedding") == -1:
print("shkip params", param.name)
param_t.set(np.float16(data).view(np.uint16), exe.place)
param_t.set(np.float16(data), exe.place)
master_param_var = fluid.global_scope().find_var(param.name +
".master")
if master_param_var is not None:
......
......@@ -30,7 +30,7 @@ def cast_fp32_to_fp16(exe, main_program):
param_t = fluid.global_scope().find_var(param.name).get_tensor()
data = np.array(param_t)
if param.name.find("layer_norm") == -1:
param_t.set(np.float16(data).view(np.uint16), exe.place)
param_t.set(np.float16(data), exe.place)
master_param_var = fluid.global_scope().find_var(param.name +
".master")
if master_param_var is not None:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册