fix fp16 initializer dtype check test=develop (#15669)

revert-15661-fix-cpu-broadcast
Wu Yi 6 years ago committed by GitHub
parent b80bcbb4fd
commit fc198b1fea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -302,7 +302,8 @@ class LayerHelper(object):
if default_initializer is None and attr.initializer is None: if default_initializer is None and attr.initializer is None:
if isinstance(dtype, core.VarDesc.VarType): if isinstance(dtype, core.VarDesc.VarType):
if dtype != core.VarDesc.VarType.FP32 and \ if dtype != core.VarDesc.VarType.FP32 and \
dtype != core.VarDesc.VarType.FP64: dtype != core.VarDesc.VarType.FP64 and \
dtype != core.VarDesc.VarType.FP16:
raise TypeError( raise TypeError(
"Can not create parameter with default initializer when dtype is not float type. Set default_initializer to fit the parameter dtype!" "Can not create parameter with default initializer when dtype is not float type. Set default_initializer to fit the parameter dtype!"
) )

Loading…
Cancel
Save