美文网首页我爱编程
TensorFlow学习笔记1.2:tf.constant

TensorFlow学习笔记1.2:tf.constant

作者: HBU_DAVID | 来源:发表于2018-04-13 13:59 被阅读21次

    tf.constant(value,dtype=None,shape=None,name='Const')

    创建一个常量tensor,先给出value,可以设定其shape

    Constant 1-D Tensor populated with value list.

     tensor = tf.constant([1, 2, 3, 4, 5, 6, 7]) => [1 2 3 4 5 6 7] 
    

    Constant 2-D tensor populated with scalar value -1.

     tensor = tf.constant(-1.0, shape=[2, 3]) => [[-1. -1. -1.] [-1. -1. -1.]]
    

    https://www.cnblogs.com/likethanlove/p/6227523.html
    http://devdocs.io/tensorflow~python/tf/constant

    相关文章

      网友评论

        本文标题:TensorFlow学习笔记1.2:tf.constant

        本文链接:https://www.haomeiwen.com/subject/ltpckftx.html