【问题标题】:TensorFlow python loop "for" performanceTensorFlow python循环“for”性能
【发布时间】:2017-06-19 20:07:13
【问题描述】:

我在使用 tensorflow 的 python 中遇到了性能问题。 下面的循环运行延迟很好,有没有办法改变或优化这个循环?

learning_rate_multiplier = tf.stack(
    [tf.tile(tf.slice(learning_rate_op, np.array([i]), np.array([1])), [dim])
            for i in range(m * n)])

谢谢

【问题讨论】:

  • learning_rate_op 是如何定义的?

标签: python arrays tensorflow


【解决方案1】:

我解决了我的问题,将 learning_rate_multiplier 修改为

tf.reshape(self._learning_rate, [self._m * self._n, 1]

【讨论】:

    猜你喜欢
    • 2018-11-08
    • 1970-01-01
    • 2015-08-28
    • 2012-11-25
    • 1970-01-01
    • 2012-11-18
    • 2020-09-04
    • 2019-04-01
    • 1970-01-01
    相关资源
    最近更新 更多