import tensorflow as tf v1 = tf.Variable(tf.random_normal([1], stddev=1, seed=1)) v2 = tf.Variable(tf.random_normal([1], stddev=1, seed=1)) result = v1 + v2 init_op = tf.global_variables_initializer() saver = tf.train.Saver() with tf.Session() as ses…
import tensorflow as tf from tensorflow.python.framework import graph_util v1 = tf.Variable(tf.constant(1.0, shape=[1]), name = "v1") v2 = tf.Variable(tf.constant(2.0, shape=[1]), name = "v2") result = v1 + v2 init_op = tf.global_varia…
import tempfile import tensorflow as tf input_data = [1, 2, 3, 5, 8] dataset = tf.data.Dataset.from_tensor_slices(input_data) # 定义迭代器. iterator = dataset.make_one_shot_iterator() # get_next() 返回代表一个输入数据的张量. x = iterator.get_next() y = x * x with tf.S…
import glob import os.path import numpy as np import tensorflow as tf from tensorflow.python.platform import gfile # 原始输入数据的目录,这个目录下有5个子目录,每个子目录底下保存这属于该 # 类别的所有图片. INPUT_DATA = 'F:\\TensorFlowGoogle\\201806-github\\datasets\\flower_photos\\' # 输出文件地址…
import glob import os.path import numpy as np import tensorflow as tf from tensorflow.python.platform import gfile import tensorflow.contrib.slim as slim # 加载通过TensorFlow-Slim定义好的inception_v3模型. import tensorflow.contrib.slim.python.slim.nets.incepti…
import tensorflow as tf v = tf.Variable(0, dtype=tf.float32, name="v") for variables in tf.global_variables(): print(variables.name) ema = tf.train.ExponentialMovingAverage(0.99) maintain_averages_op = ema.apply(tf.global_variables()) for variab…
import tensorflow as tf tf.reset_default_graph() # 配置神经网络的参数 INPUT_NODE = 784 OUTPUT_NODE = 10 IMAGE_SIZE = 28 NUM_CHANNELS = 1 NUM_LABELS = 10 # 第一层卷积层的尺寸和深度 CONV1_DEEP = 32 CONV1_SIZE = 5 # 第二层卷积层的尺寸和深度 CONV2_DEEP = 64 CONV2_SIZE = 5 # 全连接层的节点个数 FC…
# -*- coding: utf-8 -*- import glob import os.path import numpy as np import tensorflow as tf from tensorflow.python.platform import gfile import tensorflow.contrib.slim as slim import tensorflow.contrib.slim.python.slim.nets.inception_v3 as inceptio…
import glob import os.path import numpy as np import tensorflow as tf from tensorflow.python.platform import gfile import tensorflow.contrib.slim as slim # 因为slim.nets包在 tensorflow 1.3 中有一些问题,所以这里为了方便 # 我们将slim.nets.inception_v3中的代码拷贝到了同一个文件夹下. # imp…
import glob import os.path import numpy as np import tensorflow as tf from tensorflow.python.platform import gfile # 原始输入数据的目录,这个目录下有5个子目录,每个子目录底下保存这属于该 # 类别的所有图片. INPUT_DATA = 'F:\\TensorFlowGoogle\\201806-github\\datasets\\flower_photos\\' # 输出文件地址…