Intermediate layer in keras to fetch the weights, convert and feed to the network

135 views Asked by At

I have custom layer model using graph structure in keras. I want to add an intermediate layer between each pair of existing layer. The function of this layer will be to add some noise similar to GaussianNoise layer provided by keras. I want to manipulate the weights from the previous layer and then feed it to the next layer.

My problem is I cant understand how to fetch these weights from the previous layer. I looked GaussianNoise layer as an example. The call method is defined as :

def call(self, x, mask=None):
    noise_x = x + K.random_normal(shape=K.shape(x),
                                  mean=0.,
                                  std=self.sigma)
    return K.in_train_phase(noise_x, x)

The 'x' is a TensorVariable and it has no information about the weights. How can I get weight's within this intermediate layer?

Thanks

0

There are 0 answers