import tensorflow as tf

    def bias_variable(self,name, shape):
        with tf.variable_scope(name)  as scope:
            biases = tf.get_variable('biaess',
                                     shape=shape,
                                     dtype=tf.float32,
                                     initializer=tf.constant_initializer(0.01))

            return biases

    # 定义一个卷积层，命名空间为name，输入为x，卷积核为W，步长为stride,偏差为bias,激活函数默认为relu
    def conv2d(self,name, x, W, stride, bias):
        with tf.variable_scope(name) as scope:
            conv = tf.nn.conv2d(x, W, [1, stride, stride, 1], padding='SAME')
            pre_activation = tf.nn.bias_add(conv, bias)
            output = tf.nn.relu(pre_activation, name=scope.name)

            return output

    # 定义一个池化层，默认为max_pooling
    def max_pool_2x2(self,name, x):
        with tf.variable_scope(name) as scope:
            maxpool = tf.nn.max_pool(x, [1, 2, 2, 1], [1, 2, 2, 1], padding='SAME')
            return maxpool

    # 创建DQN
    def creat_network(self):
        # 网络的参数，权重
        W_conv1 = self.weight_variable('W_conv1', [8, 8, 4, 32])  # 第一层卷积层为8x8的卷积核，输入通道为4，输出通道为32
