【问题标题】:equivalence of Theano.tensor.ivector of Theano in TensorflowTensorflow 中 Theano 的 Theano.tensor.ivector 的等价性
【发布时间】:2018-12-24 07:03:15
【问题描述】:

我是 Tensorflow 和 Theano 的新手。

Tensorflow 中的等价的 Theano.tensor.ivector 是什么?

例如,

x = Theano.tensor.ivector('x')
y = Theano.tensor.ivector('y')

【问题讨论】:

    标签: python tensorflow machine-learning theano


    【解决方案1】:

    据我了解,类似这样的东西是等价的:

    import tensorflow as tf
    
    x = tf.Variable([1, -2, 3], tf.int32, name='x')
    

    您可以在以下链接中找到有关 theano 和 tensorflow 变量的更多信息(感谢 bouteillebleu):

    http://deeplearning.net/software/theano/library/tensor/basic.html https://www.tensorflow.org/programmers_guide/dims_types


    如果您使用这些作为输入并且您不知道初始内容,则必须使用占位符:

    import tensorflow as tf
    
    x = tf.placeholder(tf.int32, name='x')
    

    【讨论】:

    • 基于deeplearning.net/software/theano/library/tensor/basic.html(对于 Theano 数据类型)和 tensorflow.org/programmers_guide/dims_types(对于 Tensorflow 数据类型),看起来是对的。 (值得在您的帖子中链接这些内容吗?)
    • 但我不明白的是,x 不存在。这是第一次使用我在问题中编写的函数创建 x。我怎么知道x的内容和维度是什么?
    • 我明白了。我正在更新答案。
    • @bouteillebleu 我按照您的建议添加了链接。谢谢!
    猜你喜欢
    • 2017-03-18
    • 2016-05-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-28
    • 2017-01-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多