TensorFlow 测试样例tf.constant
TensorFlow 测试样例tf.constant

#!/usr/bin/env python3.7
# -*- coding: utf-8 -*-
import tensorflow as tf
import numpy as np
a=tf.constant(2,name="a")
b=tf.constant(4,name="b")
result=a+b
#print(result)#直接输出,只会得到一个tensor
sess=tf.Session()#创建会话,
print("the result is ",sess.run(result))#运行结果,打印是会话session 运行run之后的结果

输出结果

the result is  6

(从今天开始记录一下笔记)

相关文章:

  • 2021-08-23
  • 2021-07-28
  • 2021-11-26
  • 2021-06-26
  • 2022-12-23
  • 2022-02-09
  • 2022-01-08
  • 2022-02-12
猜你喜欢
  • 2022-12-23
  • 2021-08-12
  • 2021-07-06
  • 2021-07-31
  • 2022-12-23
  • 2021-04-12
相关资源
相似解决方案