(self, input_signature)
Randomly initializes this layer's weights.
Randomly initializes this layer's weights.
Randomly initializes this layer s weights .
def init_weights_and_state(self, input_signature):
    """Randomly initializes this layer's weights."""
    d_model = input_signature.shape[-1]
    shape_w1 = (self._d_ff, d_model)
    shape_w2 = (self._d_ff, d_model)
    shape_b2 = (d_model,)

    rng_w1, rng_w2, rng_b2 = fastmath.random.split(self.rng, 3)
    w1 = self._kernel_initializer(shape_w1, rng_w1)
    w2 = self._kernel_initializer(shape_w2, rng_w2)
    b2 = self._bias_initializer(shape_b2, rng_b2)
    self.weights = (w1, w2, b2)
def init_weights_and_state ( self , input_signature ) : d_model = input_signature . shape [ - 1 ] shape_w1 = ( self . _d_ff , d_model ) shape_w2 = ( self . _d_ff , d_model ) shape_b2 = ( d_model , ) rng_w1 , rng_w2 , rng_b2 = fastmath . random . split ( self . rng , 3 ) w1 = self . _kernel_initializer ( shape_w1 , rng_w1 ) w2 = self . _kernel_initializer ( shape_w2 , rng_w2 ) b2 = self . _bias_initializer ( shape_b2 , rng_b2 ) self . weights = ( w1 , w2 , b2 )