随笔分类 - tensorflow
摘要:版本问题 keras和tensorflow的版本对应关系
阅读全文
摘要:Tensorflow 模型的保存、读取和冻结、执行
阅读全文
摘要:转自 https://www.cnblogs.com/zerotoinfinity/p/10242849.html 一、模型的保存 使用tensorflow训练模型的过程中,需要适时对模型进行保存,以及对保存的模型进行restore,以便后续对模型进行处理。如:测试、部署、拿别的模型进行fine-t
阅读全文
摘要:代码如下: import tensorflow as tf def get_all_layernames(): """get all layers name""" pb_file_path = '/home/nvidia/sq/facenet-master/model_checkpoints/fre
阅读全文
摘要:numpy与tensor数据相互转化: *Numpy2Tensor 虽然TensorFlow网络在输入Numpy数据时会自动转换为Tensor来处理,但是我们自己也可以去显式的转换: data_tensor= tf.convert_to_tensor(data_numpy) *Tensor2Nump
阅读全文
摘要:import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data # 载入数据集 mnist = input_data.read_data_sets("MNIST_data", one_hot=True) # 批次大小 batch_size = 64 # 计算一个周期一共有多少个批次 n_b...
阅读全文
摘要:import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data #载入数据集 mnist = input_data.read_data_sets("MNIST_data",one_hot=True)
阅读全文
摘要:Iter 0,Testing Accuracy 0.9451,Training Accuracy 0.94643635 Iter 1,Testing Accuracy 0.9529,Training Accuracy 0.9566909 Iter 2,Testing Accuracy 0.96,Tr
阅读全文
摘要:import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data #载入数据集 mnist = input_data.read_data_sets("MNIST_data",one_hot=True)
阅读全文
摘要:import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data # 载入数据集 mnist = input_data.read_data_sets("MNIST_data", one_hot=Tru
阅读全文
摘要:import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data # 载入数据集 mnist = input_data.read_data_sets("MNIST_data", one_hot=True) # 批次大小 batch_size = 64 # 计算一个周期一共有多少个批次 n_b...
阅读全文
摘要:import tensorflow as tf import numpy as np import matplotlib.pyplot as plt # numpy生成200个随机点 x_data = np.linspace(-0.5,0.5,200)[:,np.newaxis] noise = np.random.normal(0,0.02,x_data.shape) y_data = n...
阅读全文
摘要:import tensorflow as tf import numpy as np import matplotlib.pyplot as plt x_data = np.random.rand(100) noise = np.random.normal(0,0.01,x_data.shape) y_data = x_data*0.1 + 0.2 + noise plt.scatter(x_da
阅读全文
摘要:import tensorflow as tf # Fetch:可以在session中同时计算多个tensor或执行多个操作 # 定义三个常量 input1 = tf.constant(3.0) input2 = tf.constant(2.0) input3 = tf.constant(5.0) # 加法op add = tf.add(input2,input3) # 乘法op mul = tf
阅读全文
摘要:import tensorflow as tf # 定义一个变量 x = tf.Variable([1,2]) # 定义一个常量 a = tf.constant([3,3]) # 减法op sub = tf.subtract(x, a) # 加法op add = tf.add(x,sub) # 所有变量初始化 init = tf.global_variables_initializer() wit
阅读全文
摘要:import tensorflow as tf # 创建一个常量 m1 = tf.constant([[3,3]]) # 创建一个常量 m2 = tf.constant([[2],[3]]) # 矩阵乘法op product = tf.matmul(m1, m2) print(product) # 定义会话 sess = tf.Session() # 调用sess中的run方法来执行矩阵乘法op
阅读全文
摘要:转自:https://www.cnblogs.com/geeksongs/p/10745419.html 安装tensorflow时,如果使用直接安装速度相对较慢,采取清华大学的镜像会提高速度。GPU版本安装方法: pip install tensorflow-gpu==1.8 -i https:/
阅读全文
摘要:在Python环境中输入: 输出:
阅读全文