python - 如何为 LSTM 填充时间戳
问题描述
我正在尝试为 LSTM 填充我的序列数据,我的数据 x 看起来像
x = [[[1],[2],[3]],[[1],[2]],...]
在模型中,我尝试像这样填充:
from tensorflow.keras.preprocessing.sequence import pad_sequences
x = Input(batch_shape = (None, None, 1), dtype = 'int32', name = 'x')
padded_x = pad_sequences(x, padding="post")
然后,我收到一条错误消息:
len is not well defined for symbolic Tensors. (x:0) Please call `x.shape` rather than `len(x)` for shape information.
我的猜测是它发生batch_shape = (None, None, 1)
在输入层中。但我需要使用它,因为每个样本都有不同的时间戳。
解决方案
推荐阅读
- postgresql - 如何在 Sequelize UPDATE 中设置 jsonb_column = json_build_array( string_column )?
- javascript - var 值转换为 2 个小数位值
- c# - Unity 移动平台脚本停止工作?
- python - 提取图像中的车牌号
- sql - 如何获得在同一行列出的分组总和?
- mysql - MySQL使用过程获取多行和多列
- java - 当字符位于数组的第二行时,为什么我的代码不起作用?
- python - pandas 是否支持将多个表中的数据读取到数据框中?
- python - 如何有效地计算大型数组中的整数匹配并存储这些计数以供以后使用?
- javascript - PNG 在 Umbraco 的媒体部分显示为黑色图块