python2.7paddle1.6下,embedding函数的dtype参数若采用unicode会报错。
Created by: Meiyim
测试环境: python2.7 + paddle 1.6.0 embedding函数的dtype参数若采用unicode会报错 复现代码:
from __future__ import unicode_literals
import paddle as p
import paddle.fluid as f
from paddle.fluid import core
print(p.__version__)
ids = f.data(shape=[None, None, 1], dtype='int64', name='a')
f.layers.embedding(ids, size=[10000, 32], param_attr=f.ParamAttr(name='emb'), dtype='float32')
错误log
1.6.0
Traceback (most recent call last):
File "shit17.py", line 9, in <module>
f.layers.embedding(ids, size=[10000, 32], param_attr=f.ParamAttr(name='emb'), dtype='float32')
File "/home/work/chenxuyi/playground/off-ernie/app/lib/python2.7/site-packages/paddle/fluid/layers/nn.py", line 614, in embedding
if convert_dtype(dtype) in ['float16']:
File "/home/work/chenxuyi/playground/off-ernie/app/lib/python2.7/site-packages/paddle/fluid/data_feeder.py", line 37, in convert_dtype
if dtype == core.VarDesc.VarType.BOOL:
TypeError: __eq__(): incompatible function arguments. The following argument types are supported:
1. (self: paddle.fluid.core_avx.VarDesc.VarType, arg0: paddle.fluid.core_avx.VarDesc.VarType) -> bool
2. (self: paddle.fluid.core_avx.VarDesc.VarType, arg0: int) -> bool
Invoked with: VarType.BOOL, u'float32