lhj*_*ohn 5 python gpu assertion tensorflow
我正在尝试使用MirroredStrategy来使用两个Titan Xp GPU来适应我的顺序模型。我在Ubuntu 16.04上使用tensorflow 2.0 alpha。
我成功地从tensorflow文档中运行了代码片段:
from __future__ import absolute_import, division, print_function, unicode_literals
import tensorflow as tf
mirrored_strategy = tf.distribute.MirroredStrategy()
with mirrored_strategy.scope():
model = tf.keras.Sequential([tf.keras.layers.Dense(1, input_shape=(1,))])
model.compile(loss='mse', optimizer='sgd')
dataset = tf.data.Dataset.from_tensors(([1.], [1.])).repeat(100).batch(10)
model.fit(dataset, epochs=2)
model.evaluate(dataset)
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试训练我的数据时,它是一个稀疏的形状矩阵(使用adam优化器和二进制交叉熵):
Shape X_train: (91422, 65545)
Shape y_train: (91422, 1)
Run Code Online (Sandbox Code Playgroud)
我在_distribution_standardize_user_data中收到断言错误
assert isinstance(x, dataset_ops.DatasetV2)
Run Code Online (Sandbox Code Playgroud)
在tensoflow代码中,training.py中的 2166行似乎引起了此断言错误。
有人可以向我解释我的数据可能是什么问题吗?