我试着做后垫但我得到的所有值都是零。如何从可用值中获取值。
raw_inputs = [
[-6.7329314e-04, -3.2805078e-04, 9.8458688e-05],
[-6.7329314e-04, -3.2805078e-04, 9.8458688e-05,-6.7329314e-04, -3.2805078e-04, 9.8458688e-05],
[-6.7329314e-04, -3.2805078e-04, 9.8458688e-05,-6.7329314e-04, -3.2805078e-04, 9.8458688e-05,-6.7329314e-04, -3.2805078e-04, 9.8458688e-05],
]
# By default, this will pad using 0s; it is configurable via the
# "value" parameter.
# Note that you could "pre" padding (at the beginning) or
# "post" padding (at the end).
# We recommend using "post" padding when working with RNN layers
# (in order to be able to use the
# CuDNN implementation of the layers).
padded_inputs = tf.keras.preprocessing.sequence.pad_sequences(
raw_inputs, padding="post"
)
print(padded_inputs)
请帮我这个。先谢谢你了
1条答案
按热度按时间5jvtdoz21#
默认情况下,pad_sequences返回dtype='int32'中的数据,这是因为您的数据被强制转换为零...指定dtype='float64'可以解决这个问题