【问题标题】:Tensorflow session.run() does not proceedTensorflow session.run() 没有继续
【发布时间】:2019-06-12 02:22:12
【问题描述】:

我在我的机器上运行https://github.com/lordet01/segan/blob/master/train_segan.sh。代码不会在下面的行(在 model.py 中)继续:

sample_noisy, sample_wav, sample_z = self.sess.run([self.gtruth_noisy[0], self.gtruth_wavs[0], self.zs[0]]) 

作为一个 tensorflow 初学者,这条线似乎只是将节点转换为张量。

您能否提出任何可能的原因,为什么它没有从上面的行开始? 我真的很感谢任何 cmets :)

我的计算环境如下: Python 3.6.0(由 Anaconda 安装)、TensorFlow 1.2.1、Cuda 8.0、TitanX(x2)

【问题讨论】:

  • 错误是什么?
  • 这也发生在我身上。你在用queues吗?
  • @UtkarshAgarwal 没有错误。只需程序在上面的行停止。
  • @PratikDeoghare 代码尝试使用队列(例如 threads = tf.train.start_queue_runners(coord=coord) ),但似乎与 sess.run() 无关。
  • @PratikDeoghare 感谢您的回复!但就我而言,在 sess.run(tf.global_variables_initializer()) 之前添加 sess.run(tf.local_variables_initializer()) 不会改变任何情况。

标签: python tensorflow


【解决方案1】:

由于问题老了,而且仓库跟原来的master分支不是最新的,所以网络的优化是不行的。

引入的一些重要更改是here

所以基本上你的模型永远不会收敛(或至少需要很长时间)的原因,因为所有梯度都存储为列表。

新增内容与您的问题相关:

def build_model(self, config):
        all_d_grads = []
        all_g_grads = []
        d_opt = tf.train.RMSPropOptimizer(config.d_learning_rate) #these lines are new
        g_opt = tf.train.RMSPropOptimizer(config.g_learning_rate) #these lines are new

新:

# deemphasize
c_res = de_emph(c_res, self.preemph)

#segan/data_loader method
def de_emph(y, coeff=0.95):
    if coeff <= 0:
        return y
    x = np.zeros(y.shape[0], dtype=np.float32)
    x[0] = y[0]
    for n in range(1, y.shape[0], 1):
        x[n] = coeff * x[n - 1] + y[n]
    return x

旧:

#There is no deemphasize, having which saves a considerable amount of time.

还有一些小的变化,比如整个转换为一个所有值都保留为 object..etc 的类。

【讨论】:

    猜你喜欢
    • 2020-08-13
    • 1970-01-01
    • 1970-01-01
    • 2015-02-11
    • 1970-01-01
    • 2016-02-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多