输出 TensorFlow 中的张量

代码参考《TensorFlow:实战Google深度学习框架》,本地手打,调试后复制出来,和原文会有差别。


#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tensorflow as tf
a=tf.constant([1.0,2.0],name="a")
b=tf.constant([3.0,4.0],name="b")
result=tf.add(a,b,name="add")
print result

输出结果:

Tensor("add:0", shape=(2,), dtype=float32)

Be the first to comment

Leave a Reply

Your email address will not be published.