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)
是数据量分组的时候不够了,可以加几个或者删除几个