本文主要是介绍Get Started with TensorFlow,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
TensorFlow是一个用于研究和生产的开源机器学习库。 TensorFlow为初学者和专家提供API,以便为桌面,移动,Web和云开发。请参阅以下部分以开始使用。
学习和使用ML
高级Keras API提供构建块来创建和训练深度学习模型。从这些适合初学者的笔记本示例开始,然后阅读TensorFlow Keras指南。
- Basic classification https://tensorflow.google.cn/tutorials/keras/save_and_restore_models
- Text classification https://tensorflow.google.cn/tutorials/keras/basic_text_classification
- Regression https://tensorflow.google.cn/tutorials/keras/basic_regression
- Overfitting and underfitting https://tensorflow.google.cn/tutorials/keras/overfit_and_underfit
- Save and load https://tensorflow.google.cn/tutorials/keras/save_and_restore_models
import tensorflow as tf mnist = tf.keras.datasets.mnist(x_train, y_train),(x_test, y_test) = mnist.load_data() #下载数据集 x_train, x_test = x_train / 255.0, x_test / 255.0 #归一化像素值model = tf.keras.models.Sequential([ #构建模型tf.keras.layers.Flatten(input_shape=(28, 28)),tf.keras.layers.Dense(512, activation=tf.nn.relu),tf.keras.layers.Dropout(0.2),tf.keras.layers.Dense(10, activation=tf.nn.softmax) ]) model.compile(optimizer='adam', #优化器(更新模型参数),损失函数(数据拟合好坏的模型),以及数据拟合损失值情况(根据这个损失值来调整)loss='sparse_categorical_crossentropy',metrics=['accuracy'])model.fit(x_train, y_train, epochs=5) #模型的拟合,开始训练(这个函数会调用前面我们定义的损失函数和优化器以及损失值以便更新模型的参数更好的拟合数据) model.evaluate(x_test, y_test) #评估模型在测试集上的情况
研究和实验
热切的执行为高级操作提供了一个必要的,按运行定义的界面。使用自动区分编写自定义图层,前进传递和训练循环。从这些笔记本开始,然后阅读热切的执行指南(https://tensorflow.google.cn/guide/eager)
1.热切的执行基础 https://tensorflow.google.cn/tutorials/eager/eager_basics
2.自动分色和渐变胶带 https://tensorflow.google.cn/tutorials/eager/automatic_differentiation
3.定制培训:基础知识 https://tensorflow.google.cn/tutorials/eager/custom_training
4.自定义图层 https://tensorflow.google.cn/tutorials/eager/custom_layers
5.定制培训:演练 https://tensorflow.google.cn/tutorials/eager/custom_training_walkthrough
https://tensorflow.google.cn/guide/keras
ML在生产规模
估算人员可以在生产环境中的多台机器上训练大型模型。 TensorFlow提供了一组预制的估算器来实现常见的ML算法。请参阅Estimators指南。
1.使用Estimators构建线性模型 https://tensorflow.google.cn/tutorials/estimators/linear
2.使用Estimators进行广泛而深入的学习 https://github.com/tensorflow/models/tree/master/official/wide_deep
3.提升树 https://github.com/tensorflow/models/tree/master/official/boosted_trees
4.如何使用TF-Hub构建简单的文本分类器 https://tensorflow.google.cn/hub/tutorials/text_classification_with_tf_hub
5.使用估算器构建卷积神经网络 https://tensorflow.google.cn/tutorials/estimators/cnn
https://tensorflow.google.cn/guide/eager
Google Colab:学习和使用TensorFlow的简便方法
Colaboratory是一个谷歌研究项目,旨在帮助传播机器学习教育和研究。这是一个Jupyter笔记本环境,无需使用任何设置,完全在云端运行。阅读博客文章。
https://tensorflow.google.cn/guide/estimators
Build your first ML app
Create and deploy TensorFlow models on web and mobile.
Web developers
TensorFlow.js is a WebGL accelerated, JavaScript library to train and deploy ML models in the browser and for Node.js.
Mobile developers
TensorFlow Lite is lightweight solution for mobile and embedded devices.
Videos and updates
订阅TensorFlow YouTube频道(https://www.youtube.com/tensorflow)和博客(https://blog.tensorflow.org/),了解最新视频和更新。
开始使用TensorFlow的高级API(https://www.youtube.com/watch?v=tjsHSIG8I08)
Eager execution https://www.youtube.com/watch?v=T8AW0fKP0Hs
tf.data: Fast, flexible, and easy-to-use input pipelines https://www.youtube.com/watch?v=uIcqeP7MFH0
这篇关于Get Started with TensorFlow的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!