码迷,mamicode.com
首页 > 其他好文 > 详细

4.什么是tensor(上)

时间:2018-07-20 01:15:01      阅读:164      评论:0      收藏:0      [点我收藏+]

标签:直接   info   输出   tensor   ssi   bsp   pytho   alt   com   

技术分享图片

 

技术分享图片

技术分享图片

import tensorflow as tf

const = tf.constant(3)
print(const)  # Tensor("Const:0", shape=(), dtype=int32)

a = 3
print(a)  # 3

# 可以看到如果直接打印const是不会输出3这个结果的,tensor不具备计算出值的能力,必须创建会话

sess = tf.Session()
print(sess.run(const))  # 3

  

 

4.什么是tensor(上)

标签:直接   info   输出   tensor   ssi   bsp   pytho   alt   com   

原文地址:https://www.cnblogs.com/traditional/p/9339211.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!