Tensorflow
Tensorflow 案例学习
清风冷吟
这个作者很懒,什么都没留下…
展开
-
TensorFlow2-前向传播(张量)-实战(10)
文章目录前向传播(张量)-实战What we have learnedRecaptf.GradientTape()前向传播(张量)-实战What we have learnedcreate tensor 创建张量indexing and slices 索引和切片reshape and broadcasting 重塑与传播math operations 数学运算Recap???????????? = ????????????????{????????????????{??????原创 2020-08-18 22:07:20 · 176 阅读 · 0 评论 -
TensorFlow2-数学运算(9)
文章目录数学运算运算符Operation type 操作类型+-*/%tf.math.log tf.elog2, log10?pow, sqrt@ matm同数据形状不同数据形状With broadcastingRecap 扼要重述Y = X @ W + bout = relu(X @ W + b)数学运算运算符±*/**, pow, squaresqrt//, %exp, log@, matmullinear layerOperation type 操作类型element-原创 2020-08-18 22:05:38 · 311 阅读 · 0 评论 -
TensorFlow2-Broadcasting(8)
文章目录BroadcastingKey ideaHow to understand?Why broadcasting?Broadcastable? 可广播?Situation 1:Situation 2Situation 3It's efficient and intuitive!隐式扩张显示扩张Broadcast VS TileBroadcasting作用:利用广播将原始矩阵成倍增加,广播是使数组具有兼容形状以进行算术运算的过程。向量维度扩张如果对于每个尺寸对,两个形状是相等的或其中之一是一个原创 2020-08-18 22:04:20 · 180 阅读 · 0 评论 -
TensorFlow2-维度变换(7)
文章目录维度变换简介ViewReshapeReshape is flexib 重塑是灵活的Reshape could lead to potential bugs!tf.transpo 矩阵转置[b,h,w,c]→[b, 3, h, w]Squeeze VS Expand_dimsExpand dimSqueeze dim维度变换简介shape, ndimreshapeexpand_dims/squeezetransposebroadcast_toView图片信息 [b,h,w][原创 2020-08-18 22:01:02 · 418 阅读 · 0 评论 -
TensorFlow2-索引与切片(6)
文章目录索引与切片Indexing 索引Basic indexingNumpy-style indexingstart:endIndexing by 综合使用后置切片前置切片前后切片Indexing by ::::-1 倒序... 省略号的方式Selective Indexing 选择性索引tf.gathertf.gather_ndtf.gather_nd更复杂的使用方式tf.gather_ndtf.boolean_mask索引与切片Indexing 索引Basic indexing[idx][原创 2020-08-18 21:59:24 · 339 阅读 · 0 评论 -
TensorFlow2-创建Tensor(5)
文章目录创建TensorFrom Numpy,Listnumpy创建数据并转为Tensorlist 创建数据并转为Tensortf.zerostf.zeros_liketf.onestf.fill(自定义填充)tf.random.normal(服从指定正态分布的序列)tf.random.uniform(均匀分布)Random Permutation(随机排列)tf.random.constantTypical Dim Data(典型尺寸数据)Scalar 标量LOSSVectorMatrixDim=3 Te原创 2020-08-18 21:56:12 · 957 阅读 · 0 评论 -
TensorFlow2-数据类型(4)
数据类型常见数据仓listnp.arraytf.Tensorscalar:标量、0维:1.1vector:[1.1], [1.1,1.2,…]matrix: [[1,2,3],[2,4,5],[23,45]]tensor: rank(维度) > 2常见数据类型int,float,doubleboolstring常见数据类型使用import tensorflow as tfimport numpy as np# 老版本:常量,数值不能改变# 新版本是普通原创 2020-08-18 21:54:21 · 557 阅读 · 0 评论 -
TensorFlow2-手写数字问题体验(3)
import osimport tensorflow as tffrom tensorflow import kerasfrom tensorflow.keras import layers, optimizers, datasets# 只使用cpuos.environ["CUDA_VISIBLE_DEVICES"] = "-1"# 设置 TensorFlow 的日志级别,避免输出过多提示信息os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'# 使用 ker原创 2020-08-18 21:51:48 · 208 阅读 · 0 评论 -
TensorFlow2-回归问题实战(2)
import numpy as np# y = wx + bdef compute_error_for_line_given_points(b, w, points): totalError = 0 for i in range(0, len(points)): x = points[i, 0] y = points[i, 1] # computer mean-squared-error totalError += (y原创 2020-08-18 21:39:14 · 300 阅读 · 0 评论 -
TensorFlow2-开发环境安装(1)
文章目录开发环境安装深度学习框架介绍学习建议开发环境安装CUDA安装python虚拟环境安装安装虚拟环境包编辑环境变量使环境变量生效创建并进入虚拟环境创建虚拟环境切换虚拟环境退出虚拟环境列出删除安装TensorFlow和torch为什么使用TensorFlowTensorFlow GPU与CPU运算TensorFlow2 自动求导TensorFlow2 与torch 简单语法比较开发环境安装深度学习框架介绍Scikit-learnMachinelearning,No GPUCaffe2原创 2020-08-18 21:36:57 · 244 阅读 · 0 评论 -
Tensorflow 2.1 报错整合
文章目录Tensorflow 2.1 报错整合RuntimeError: `loss` passed to Optimizer.compute_gradients should be a function when eager execution is enabled.RuntimeError: Attempting to capture an EagerTensor without buildi...原创 2020-04-20 17:35:29 · 14020 阅读 · 5 评论 -
tensorflow之RNN网络模型
tensorflow之RNN网络模型tensorflow之RNN网络模型TypeError: Input 'split_dim' of 'Split' Op has type float32 that does not match expected type of int32.AttributeError: module 'tensorflow' has no attribute 'variabl...原创 2020-04-19 22:46:35 · 3469 阅读 · 0 评论 -
Tensorflow之VGG网络模型
Tensorflow之VGG网络模型Tensorflow之VGG网络模型AttributeError: module 'scipy.misc' has no attribute 'imread'方案1方案2方案3Depth of input (32) is not a multiple of input depth of filter (3) for 'conv1_1/Conv2D' (op: '...原创 2020-04-19 20:16:06 · 2201 阅读 · 3 评论 -
Tensorflow 保存卷积神经网络模型参数
Tensorflow 保存卷积神经网络模型参数Tensorflow 保存卷积层参数Tensorflow 保存卷积层参数import numpy as npimport tensorflow as tfimport matplotlib.pyplot as pltfrom tensorflow.examples.tutorials.mnist import input_dataprin...原创 2020-04-19 18:16:01 · 963 阅读 · 0 评论 -
Tensorflow 模型的保存和读取
Tensorflow 模型的保存和读取Tensorflow 模型的保存和读取Tensorflow 模型的保存Tensorflow 模型的读取NotFoundError: Restoring from checkpoint failed. This is most likely due to a Variable name or other graph key that is missing fro...原创 2020-04-19 18:03:48 · 824 阅读 · 0 评论 -
Tensorflow 卷积结构模型
Tensorflow 卷积结构模型Tensorflow 卷积结构模型卷积结构模型AttributeError: module 'tensorflow' has no attribute 'Print'测试案例AttributeError: module 'tensorflow_core._api.v2.train' has no attribute 'AdamOptimizer'Tensorfl...原创 2020-04-19 14:10:53 · 287 阅读 · 0 评论 -
Tensorflow 神经网络模型架构
Tensorflow 神经网络模型架构Tensorflow 神经网络模型架构神经网络模型Tensorflow 神经网络模型架构import numpy as npimport tensorflow as tfimport matplotlib.pyplot as pltfrom tensorflow.examples.tutorials.mnist import input_data...原创 2020-04-19 14:08:01 · 1326 阅读 · 2 评论 -
Tensorflow 逻辑回归-分类
Tensorflow 逻辑回归-分类Tensorflow 逻辑回归-分类ModuleNotFoundError: No module named 'tensorflow.examples.tutorials'解决方案1--针对没有tutorials文件报错的解决解决办法2input_data.read_data_sets() 下载数据集失败AttributeError: module 'tenso...原创 2020-04-18 21:22:10 · 552 阅读 · 0 评论 -
Tensorflow MNIST 数据集使用
Tensorflow MNIST 数据集使用ModuleNotFoundError: No module named 'tensorflow.examples.tutorials'解决方案1--针对没有tutorials文件报错的解决解决办法2input_data.read_data_sets() 下载数据集失败# Tensorflow MNIST 数据集使用import tensorflo...原创 2020-04-18 20:33:32 · 1136 阅读 · 0 评论 -
Tensorflow 基础用法
Tensorflow 基础用法Tensorflow 基础用法tf.Variable(initializer,name)tf.matmul(w, x)tf.global_variables_initializerAttributeError: module 'tensorflow' has no attribute 'random_normal'AttributeError: module 'ten...原创 2020-04-18 16:23:38 · 888 阅读 · 0 评论