小编doo*_*ohr的帖子

Keras pad_sequences为基数为10的int()抛出无效文字

Traceback (most recent call last):
    File ".\keras_test.py", line 62, in <module>
        X_train = sequence.pad_sequences(X_train, maxlen=max_review_length)
    File "C:\Program Files\Python36\lib\site-packages\keras\preprocessing\sequence.py", line 69, in pad_sequences
        trunc = np.asarray(trunc, dtype=dtype)
    File "C:\Program Files\Python36\lib\site-packages\numpy\core\numeric.py", line 531, in asarray
    return array(a, dtype, copy=False, order=order)
ValueError: invalid literal for int() with base 10: "plus 've added commercials experience tacky"
Run Code Online (Sandbox Code Playgroud)

嗨,您好.我在尝试使用Keras的pad_sequence函数时遇到此错误.X_train是一系列字符串,其中"plus've添加的广告经历俗气"是这些字符串中的第一个.

python numpy python-3.x keras tensorflow

4
推荐指数
1
解决办法
3373
查看次数

标签 统计

keras ×1

numpy ×1

python ×1

python-3.x ×1

tensorflow ×1