【发布时间】:2021-06-20 09:31:21
【问题描述】:
我有一个包含基类的模块
class MessagePassing(tf.keras.layers.Layer):
def __init__():
super(MessagePassing, self).__init__()
....
def call():
....
我在另一个模块中导入基类
from module1 import MessgagePassing
class layer(MessagePassing):
def __init__(self, in, out):
super(layer, self).__init__()
self.W = self.add_weight("w", shape=[in, out], initializer="glorot_uniform")
....
当上面的模块被编译时,它会引发一个错误
2021-06-20 14:42:23.392722: F ./tensorflow/core/kernels/random_op_gpu.h:232]
Non-OK-status: GpuLaunchKernel(FillPhiloxRandomKernelLaunch<Distribution>, num_blocks, block_size, 0, d.stream(), gen, data, size, dist)
status: Internal: out of memory
我在调试模式下使用 vscode 运行代码,发现指向断点的指针在 self.add_weight 处停止了两次。之后它会在相当长的一段时间后引发错误。
【问题讨论】:
标签: python tensorflow2.0