Skip to content

Commit

Permalink
added initializers and self.layers for resetting weights
Browse files Browse the repository at this point in the history
  • Loading branch information
evanr70 committed Jan 29, 2024
1 parent fd22ed3 commit 1a490be
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions osl_dynamics/inference/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,17 +913,14 @@ def __init__(
self.damping = LearnableTensorLayer(
shape=(n, 1),
learn=learn,
initializer=None,
initial_value=0.5 * tf.ones((n, 1)),
initializer=initializers.Constant(0.5),
name=self.name + "_damping",
)

self.frequency = LearnableTensorLayer(
shape=(n, 1),
learn=learn,
initializer=None,
initial_value=tf.random.uniform(
(n, 1),
initializer=initializers.RandomUniform(
minval=frequency_limit[0],
maxval=frequency_limit[1],
),
Expand All @@ -933,11 +930,12 @@ def __init__(
self.amplitude = LearnableTensorLayer(
shape=(n, 1),
learn=learn and learn_amplitude,
initializer=None,
initial_value=tf.ones((n, 1)),
initializer=initializers.Constant(1.0),
name=self.name + "_amplitude",
)

self.layers = [self.damping, self.frequency, self.amplitude]

def call(self, inputs, **kwargs):
"""Calculate damped oscillator.
Expand Down Expand Up @@ -1003,6 +1001,8 @@ def __init__(
learn=learn,
)

self.layers = [self.oscillator_layer]

def call(self, inputs, **kwargs):
"""Retrieve the covariance matrices.
Expand Down

0 comments on commit 1a490be

Please sign in to comment.