tensorflow bug

1 ValueError: An initializer for variable kernel of type <dtype: 'string'> is

检查下word embedding的dtype,看是否是float32

2 在使用(Bi)-LSTM,(Bi)-RNN 时遇到下述报错信息:

tensorflow.python.framework.errors_impl.InvalidArgumentError: seq_lens(8) > input.dims(1)
[[{{node fusion/bidirectional_rnn/bw/ReverseSequence}} = ReverseSequence[T=DT_FLOAT, Tlen=DT_INT32, batch_dim=0, seq_dim=1, _device="/job:localhost/replica:0/task:0/device:CPU:0"](dropout_2/mul, _arg_Placeholder_0_0)]]

因此,在调用bidirectional_dynamic_rnn(如下)之类函数过程中,需要对传入的参数 seq_length 做一定的限制,使其不大于序列本身的长度!(seq_length不要长于maxlength)

outputs, state = tf.nn.bidirectional_dynamic_rnn(cell_fw, cell_bw,
                                                 inputs=seq_encodes,
                                                 sequence_length=seq_length,
                                                 dtype=tf.float32)

如,你可能需要在数据class中做如下处理:

batch_x_anonymous_lens[ind] = min(max_length, len(anonymous_question.split(" ")))
链接:https://www.jianshu.com/p/f555991d068a
 

3 2020-08-19 17:02:22.589846: W tensorflow/core/framework/op_kernel.cc:1318] OP_REQUIRES failed at reduction_ops_common.h:155 : Invalid argument: Invalid reduction dimension (1 for input with 1 dimension(s)

是数据量分组的时候不够了,可以加几个或者删除几个

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值