TF 手写体识别简单实例TensorFlow很适合用来进行大规模的数值计算,其中也包括实现和训练深度神经网络模型。下面将介绍TensorFlow中模型的基本组成部分,同时将构建一个CNN模型来对MNIST数据集中的数字手写体进行识别。 基本设置 在我们构建模型之前,我们首先加载MNIST数据集,
转载 2018-09-29 12:01:00
127阅读
2评论
# Python TensorFlow 实例:深度学习的入门指南 ## 一、什么是 TensorFlowTensorFlow 是一个开源的机器学习框架,由谷歌于 2015 年发布。它可以用于构建和训练各种类型的神经网络,方便研究者和工程师快速实现和测试他们的模型。TensorFlow 支持多种平台,包括 CPU、GPU 和移动设备,这使得它在深度学习领域得到了广泛的应用。 ## 二、Te
原创 1月前
4阅读
TensorFlow.js是什么一个用JavaScript实现的机器学习库。可以直接在浏览器和Node.js中适用机器学习技术了。通过上面两点可以知道TensorFlow.js首先是一个工具库,并不是一个产品,不能直接帮助我们创造价值,但是我们可以利用这个工具库开发出一个产品来创造价值。其实TensorFlow是利用JS实现,我么都知道Python是人工智能的主流语言,有了TensorFlow.j
import tensorflow as tf
原创 2023-01-13 00:37:35
87阅读
import tensorflow as tfa = tf.constant([[1,2,3],[1,2,3]])b = tf.constant([[2,3,4]])print(a.get_shape())print(b.get_shape())c = a*bc= tf.Print(c,[c])with tf.Session() as sess: print(sess.run(c))prin
原创 2022-07-19 11:38:33
57阅读
import tensorflow as tftf_file_writer = tf.python_io.TFRecordWriter("tmp")fea = [1,2,3]#tf.ones(shape=[3,2],dtype=tf.float32)label_vector= [4,5,6]#tf.zeros([2],dtype=tf.float32)example = tf.train....
原创 2022-07-19 11:51:30
53阅读
TensorFlow 更新频率实在太快,从 1.0 版本正式发布后,很多 API 接口就发生了改变。今天用 TF 训练了一个 CNN 模型,结果在保存模型的时候居然遇到各种问题。Google 搜出来的答案也是莫衷一是,有些回答对 1.0 版本的已经不适用了。后来实在没办法,就翻了墙去官网看了下,结果分分钟就搞定了~囧~。这篇文章内容不多,主要讲讲 TF v1.0 版本中保存和读取模型的最简单用法,
import tensorflow as tf# 创建一个常量 op, 产生一个 1x2 矩阵. 这个 op 被作为一个节点# 加到默认图中.## 构造器的返回值代表该常量 op 的返回值.matrix1 = tf.constant([[3., 3.]])# 创建另外一个常量 op, 产生一个 2x1 矩阵.matrix2 = tf.constant([[2.],[2.]])# 创建一个矩阵乘法
原创 2023-01-13 06:03:18
343阅读
1.tf.Graph()你一旦开始你的任务,就已经有一个默认的图已经创建好了。而且可以通过调用tf.get_default_graph()来访问到。 添加一个操作到默认的图里面,只要简单的调用一个定义了新操作的函数就行。比如下面的例子展示的:import tensorflow as tf import numpy as np c=tf.constant(value=1) print(c
转载 10月前
74阅读
体验一下 TensorFlow 导包套路, 获取数据 - 特征工程, 构建网络, 模型训练,
cell = multilayer_dropout_cell( RNN_CELL_DICT[cell_type], hidden_size, n_layers, rnn_dropout) if bidirectional: cell_bw = multilayer_dropout_cell( RNN_CELL_DICT[cell_type], ...
原创 2022-07-19 19:44:25
163阅读
import tensorflow as tf import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline data = pd.read_csv("C:\\Users\\94823 ...
转载 2021-10-31 19:08:00
173阅读
2评论
tensorflow 默认 单机 占用多个GPU的内存,实际只一个GPU在跑,要自己改程序并行化https://github.com/tensorflow/models/blob/master/tutorials/image/cifar10/cifar10_multi_gpu_train.py
原创 2022-07-19 12:18:12
85阅读
import tensorflow as tfa = tf.constant([[1,2,3], [1,2,3], [1,2,3]])l = tf.constant([2,2,2],tf.int64)b = tf.reverse_sequence(a,seq_lengths=l,batch_dim = 0,seq_dim = 1)c = tf.Print(b,[b],summarize=9)
原创 2022-07-19 12:18:42
87阅读
import tensorflow as tftemp = tf.tile([1,2,3],[2])temp2 = tf.tile([[1,2],[3,4],[5,6]],[
原创 2022-07-19 11:41:16
137阅读
import tensorflow as tfn1 = tf.constant(2)n2 = tf.co
原创 2022-07-19 19:47:53
355阅读
import tensorflow as tfimport numpyimport matplotlib.pyplot as pltrng = numpy.random# Parameterslearni
原创 2022-07-21 19:50:59
91阅读
【代码】tensorflow tf.where 实例
原创 2022-12-24 00:29:15
59阅读
learning_rate = tf.train.exponential_decay( initial_learning_rate, decay_steps=400,
j
原创 2022-07-19 11:48:42
78阅读
https://github.com/normanheckscher/mnist-multi-gpu/blob/master/mnist_multi_gpu_batching_train.py自己改的时候,注意的是要用tf.get_variable而不是tf.Variable
原创 2022-07-19 12:17:38
61阅读
  • 1
  • 2
  • 3
  • 4
  • 5