def dev_network_d(self, input_shape, modelname, testflag):
        '''
        deeper network architecture with three hidden layers
        '''
        x_input = Input(shape=input_shape)
        length = K.int_shape(x_input)[1]

        input_vector = Dense(length, kernel_initializer='glorot_normal',use_bias=True,activation='relu',name = 'ain')(x_input)
        en1 = Dense(128, kernel_initializer='glorot_normal',use_bias=True,activation='relu',name = 'ae1')(input_vector)
        en2 = Dense(64,kernel_initializer='glorot_normal', use_bias=True,activation='relu',name = 'ae2')(en1)
        de1 = Dense(128, kernel_initializer='glorot_normal',use_bias=True,activation='relu',name = 'ad1')(en2)
        de2 = Dense(length, kernel_initializer='glorot_normal',use_bias=True,activation='relu',name = 'ad2')(de1)

        if testflag==0:
            AEmodel = Model(x_input,de2)
            AEmodel.load_weights(modelname)
            print('load autoencoder model')

            sub_result = Subtract()([x_input, de2]) # reconstruction residual error
            cal_norm2 = Lambda(lambda x: tf.norm(x,ord = 2,axis=1))
            sub_norm2 = cal_norm2(sub_result)
            sub_norm2 = Reshape((1,))(sub_norm2)
            division = Lambda(lambda x:tf.divide(x[0],x[1]))
            sub_result = division([sub_result,sub_norm2]) # normalized reconstruction residual error
            conca_tensor = concatenate([sub_result,en2],axis=1) # [hidden representation, normalized reconstruction residual error]

            conca_tensor = concatenate([conca_tensor,sub_norm2],axis=1) # [hidden representation, normalized reconstruction residual error, residual error]
        else:
            sub_result = Subtract()([x_input, de2])
            cal_norm2 = Lambda(lambda x: tf.norm(x,ord = 2,axis=1))
            sub_norm2 = cal_norm2(sub_result)
            sub_norm2 = Reshape((1,))(sub_norm2)
            division = Lambda(lambda x:tf.divide(x[0],x[1]))
            sub_result = division([sub_result,sub_norm2])
            conca_tensor = concatenate([sub_result,en2],axis=1)

            conca_tensor = concatenate([conca_tensor,sub_norm2],axis=1)

        intermediate = Dense(256, kernel_initializer='glorot_normal',use_bias=True,activation='relu',name = 'hl2')(conca_tensor)
        intermediate = concatenate([intermediate,sub_norm2],axis=1) # concat the intermediate vector with the residual error
        intermediate = Dense(32, kernel_initializer='glorot_normal',use_bias=True,activation='relu',name = 'hl3')(intermediate)
        intermediate = concatenate([intermediate,sub_norm2],axis=1) # again, concat the intermediate vector with the residual error
        output_pre = Dense(1, kernel_initializer='glorot_normal',use_bias=True,activation='linear', name = 'score')(intermediate)
        dev_model = Model(x_input, output_pre)

        def multi_loss(y_true,y_pred):
            confidence_margin = 5.

            dev = y_pred
            inlier_loss = K.abs(dev)
            outlier_loss = K.abs(K.maximum(confidence_margin - dev, 0.))

            sub_nor = tf.norm(sub_result,ord = 2,axis=1)
            outlier_sub_loss = K.abs(K.maximum(confidence_margin - sub_nor, 0.))
            loss1 =  (1 - y_true) * (inlier_loss+sub_nor) + y_true * (outlier_loss+outlier_sub_loss)

            return loss1

        adm = Adam(lr=0.0001)
        dev_model.compile(loss=multi_loss, optimizer=adm)

        return dev_model

        deeper network architecture with three hidden layers
        
adbench/baseline/FEAWAD/run.py