> For the complete documentation index, see [llms.txt](https://minghuiwu.gitbook.io/tfbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://minghuiwu.gitbook.io/tfbook/di-san-zhang-mo-dao-bu-wu-kan-chai-gong-tensorflow-ji-chu/di-san-zhang-tensorflow-ji-chu/3.1-tensorflow-ji-chu.md).

# 3.1 TensorFlow 基础

### 3.1 TensorFlow 基础

**3.1.1 TensorFlow 简介**

谷歌在TensorFlow的官方网站上使用这么一句话来描述TensorFlow：”**A machine learning platform for everyone to solve real problems**”,也就是说它是一个用于解决实际问题的开源机器学习平台。

![图 3-1 TensorFlow 1.x LOGO](/files/-L_X_y5hBhJj2eVNe2Kz)

TensorFlow最初是由Google Brain团队（隶属于Google的AI部门）中的研究人员和工程师开发的，可以为机器学习和深度学习提供强力支持。我们可以借助其灵活的架构，将其轻松地将计算工作部署到多种平台（CPU、GPU、TPU）和设备（桌面设备、服务器集群、移动设备、边缘设备等）上。

**3.1.2 TensorFlow的Hello World**

图2中的输出栏前面的‘b’表示**Bytes literals**（字节文字）。大多数人安装好TensorFlow后都会使用这段代码来测试安装是否成功。

![图3-2 Hello World](/files/-L_XaHyfLm67vUm-QJHD)

## > 示例代码

{% code title="1.py" %}

```python
import tensorflow as tf

# 创建一个常量运算，将作为一个节点加入到默认计算图中
hello = tf.constant("Hello, World!")

# 创建一个TF对话
sess = tf.Session()

# 运行并获得结果
print(sess.run(hello))
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://minghuiwu.gitbook.io/tfbook/di-san-zhang-mo-dao-bu-wu-kan-chai-gong-tensorflow-ji-chu/di-san-zhang-tensorflow-ji-chu/3.1-tensorflow-ji-chu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
