import tensorflow as tf


def get_test_batch(image,label,batch_size):
    images,labels=tf.train.batch([image,label],batch_size=batch_size)
    return tf.reshape(images,[batch_size,4096]),tf.reshape(labels,[batch_size])

def get_valid_batch(image,label,batch_size):
    images,labels=tf.train.batch([image,label],batch_size=batch_size)
    return tf.reshape(images,[batch_size,4096]),tf.reshape(labels,[batch_size])
    
class trainwork(object):
    def __init__(self):
        with tf.variable_scope('scop'):
            self.w1=tf.get_variable('w1', [4096,2048],initializer=tf.contrib.layers.xavier_initializer_conv2d())
            self.w2=tf.get_variable('w2', [2048,3072],initializer=tf.contrib.layers.xavier_initializer_conv2d())
            self.w3=tf.get_variable('w3', [3072,512],initializer=tf.contrib.layers.xavier_initializer_conv2d())
            self.w4=tf.get_variable('w4', [512,classnum],initializer=tf.contrib.layers.xavier_initializer_conv2d())
            self.b1 = tf.get_variable('b1', [2048],initializer=tf.constant_initializer(0.0))
            self.b2 = tf.get_variable('b2', [3072],initializer=tf.constant_initializer(0.0))
            self.b3 = tf.get_variable('b3', [512],initializer=tf.constant_initializer(0.0))
            self.b4 = tf.get_variable('b4', [classnum],initializer=tf.constant_initializer(0.0))

    def inference(self,images):
        images=tf.cast(images,tf.float32)/255.0
        l1 = tf.matmul(images, self.w1)+self.b1
        l1=tf.nn.relu(l1)
        l2 = tf.matmul(l1, self.w2)+self.b2
