3

内核在运行一些代码后死亡
我尝试运行代码以使用生成器生成示例图像 我尝试更新 conda 和 Jupiter 但它们都不起作用

我一直在观察 GPU 的内存使用情况,但它并没有那么多使用 GPU

张量流2.0,ubuntu 18.10,cuda 10.0
python 3.5,

def make_generator_model():
    model = tf.keras.Sequential()
    model.add(layers.Dense(7*7*256, use_bias=False, input_shape=(100,)))
    model.add(layers.BatchNormalization())
    model.add(layers.LeakyReLU())

    model.add(layers.Reshape((7, 7, 256)))
    assert model.output_shape == (None, 7, 7, 256) # Note: None is the batch size

    model.add(layers.Conv2DTranspose(128, (5, 5), strides=(1, 1), padding='same', use_bias=False))
    assert model.output_shape == (None, 7, 7, 128)
    model.add(layers.BatchNormalization())
    model.add(layers.LeakyReLU())

    model.add(layers.Conv2DTranspose(64, (5, 5), strides=(2, 2), padding='same', use_bias=False))
    assert model.output_shape == (None, 14, 14, 64)
    model.add(layers.BatchNormalization())
    model.add(layers.LeakyReLU())

    model.add(layers.Conv2DTranspose(1, (5, 5), strides=(2, 2), padding='same', use_bias=False, activation='tanh'))
    assert model.output_shape == (None, 28, 28, 1)

    return model
generator = make_generator_model()

noise = tf.random.normal([1, 100])
generated_image = generator(noise, training=False)

AVX2 FMA 2019-04-18 10:20:21.107510: I tensorflow/compiler/xla/service/service.cc:168] XLA 服务 0x55de6ead0990 在平台 CUDA 上执行计算。设备:2019-04-18 10:20:21.107562:I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor 设备 (0):TITAN Xp,计算能力 6.1 2019-04-18 10:20:21.127890 :I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU 频率:3493050000 Hz 2019-04-18 10:20:21.129460:I tensorflow/compiler/xla/service/service.cc:168] XLA 服务 0x55de6eed7eb0在平台主机上执行计算。设备:2019-04-18 10:20:21.129503:I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor 设备 (0):, 2019-04-18 10:20:21.129616:I tensorflow/core /common_runtime/gpu/gpu_device.cc:1712] 添加可见 gpu 设备:0 2019-04-18 10:20:21.129722:

4

1 回答 1

0

根据错误的输出,它似乎是一个内存问题。

“总内存:11.91GiB 免费内存:340.69MiB”

尝试重新启动你的电脑,一旦你重新打开它,看看有多少内存可用,然后再次执行你的代码,看看它是否成功。

于 2019-04-18T09:02:18.013 回答