import tensorflow as tf
import math
import numpy as np
import matplotlib.pyplot as plt
import types
import pylab
# draw standard sin function
def draw_correct_line():
x=np.arange(0,2*np.pi,0.01)
x=x.reshape(len(x),1)
y=np.sin(x)
pylab.plot(x,y)
plt.axhline(linewidth=1,color='r')
# get train data y=sin(x) 0-2pi take one value
def get_train_data():
train_x=np.random.uniform(0.0,2*np.pi,(1)) # train_input
train_y=np.sin(train_x) # train_label
return train_x,train_y
# define three hidden nets structure
# caution: different variable defined in different scope
# caution: use tf.multiply and tf.matmul matrix calculation
def inference(input_data):
with tf.variable_scope('hidden1',):
weights=tf.get_variabl