我有一个自动编码器类,我试图将形状为(2933314600(的normal_test_data提供给编码器。我得到一个失败的复制输入张量从/job:localhost/replice:0/task:0/device:CPU:0到/job:本地主机/replice/0/task:0/device:GPU:0以便运行Cast:Dst张量未初始化。[Op:Cast]内存不足错误。如何使用数据集API方法解决此错误?任何帮助都将不胜感激。
class AutoEncoder(Model):
def _init_(self):
super(AutoEncoder, self)._init_()
#############
## ENCODER ##
#############
self.encoder = tensorflow1.keras.Sequential([
tensorflow1.keras.layers.Dense(512, activation="relu"),
tensorflow1.keras.layers.Dense(256, activation="relu"),
tensorflow1.keras.layers.Dense(128, activation="relu"),
tensorflow1.keras.layers.Dense(64, activation="relu"),
tensorflow1.keras.layers.Dense(32, activation="relu"),
tensorflow1.keras.layers.Dense(16, activation="relu")])
#############
## DECODER ##
#############
self.decoder = tensorflow1.keras.Sequential([
tensorflow1.keras.layers.Dense(32, activation="relu"),
tensorflow1.keras.layers.Dense(64, activation="relu"),
tensorflow1.keras.layers.Dense(128, activation="relu"),
tensorflow1.keras.layers.Dense(256, activation="relu"),
tensorflow1.keras.layers.Dense(512, activation="relu"),
tensorflow1.keras.layers.Dense(600, activation="sigmoid")])
def call(self, x):
encoded = self.encoder(x)
decoded = self.decoder(encoded)
return decoded
model = AutoEncoder()
encoder_out = model.encoder(normal_test_data).numpy()
这可能是一篇旧帖子,但我面临着同样的问题,因此,如果其他人正在搜索这个问题,请关注,评论#2:将输入张量从CPU复制到GPU以运行GatherVe失败:Dst张量未初始化。[操作:GatherV2]