莫烦tensorflow(6)-tensorboard】的更多相关文章

import tensorflow as tfimport numpy as np def add_layer(inputs,in_size,out_size,n_layer,activation_function=None): # add one more layer and return the output of this layer layer_name = 'layer%s' % n_layer with tf.name_scope('layer'): with tf.name_sco…
import tensorflow as tfimport numpy as np ##save to file#rember to define the same dtype and shape when restore# W = tf.Variable([[1,2,3],[3,4,5]],dtype=tf.float32,name='Weights')# b = tf.Variable([[1,2,3]],dtype=tf.float32,name='biases') # init = tf…
import tensorflow as tffrom tensorflow.examples.tutorials.mnist import input_data#number 1 to 10 datamnist = input_data.read_data_sets('MNIST_data',one_hot=True) def compute_accuracy(v_xs,v_ys): global prediction y_pre = sess.run(prediction,feed_dict…
import tensorflow as tffrom tensorflow.examples.tutorials.mnist import input_data#number 1 to 10 datamnist = input_data.read_data_sets('MNIST_data',one_hot=True) def add_layer(inputs,in_size,out_size,activation_function=None): Weights = tf.Variable(t…
import tensorflow as tfimport numpy as npimport matplotlib.pyplot as plt def add_layer(inputs,in_size,out_size,activation_function=None): Weights = tf.Variable(tf.random_normal([in_size,out_size])) biases = tf.Variable(tf.zeros([1,out_size]) + 0.1) W…
import tensorflow as tf input1 = tf.placeholder(tf.float32)input2 = tf.placeholder(tf.float32) output = tf.multiply(input1,input2) with tf.Session() as sess: print(sess.run(output,feed_dict={input1:[7.],input2:[2.0]}))…
import tensorflow as tf state = tf.Variable(0,name='counter') one = tf.constant(1) new_value = tf.add(state,one)update = tf.assign(state,new_value) init = tf.initialize_all_variables()#must have if define variable with tf.Session() as sess: sess.run(…
import os os.environ['TF_CPP_MIN_LOG_LEVEL']='2' import tensorflow as tfmatrix1 = tf.constant([[3,3]])matrix2 = tf.constant([[2],[2]])protuct = tf.matmul(matrix1,matrix2) # sess = tf.Session()# result = sess.run(protuct) # print(result)# sess.close()…
import tensorflow as tfimport numpy as np #create datax_data = np.random.rand(100).astype(np.float32)y_data = x_data*0.1+0.3 ####create tensorflow structure start###Weights = tf.Variable(tf.random_uniform([1],-1.0,1.0))biases = tf.Variable(tf.zeros([…
bilibili莫烦tensorflow视频教程学习笔记 1.初次使用Tensorflow实现一元线性回归 # 屏蔽警告 import os os.environ[' import numpy as np import tensorflow as tf # create dataset x_data = np.random.rand(100).astype(np.float32) y_data = x_data * 2 + 5 ### create tensorflow structure St…