Skip to content

Instantly share code, notes, and snippets.

@lazuxd
Created July 20, 2021 06:21
Show Gist options
  • Save lazuxd/fbc2006e9a9ac0d5c2517249ba42827e to your computer and use it in GitHub Desktop.
Save lazuxd/fbc2006e9a9ac0d5c2517249ba42827e to your computer and use it in GitHub Desktop.
def _init_lstm(self):
for s in ['wu', 'wf', 'wo', 'wc']:
setattr(self, s, [tf.Variable(tf.random.normal(
stddev=std_dev,
shape=shape,
dtype=tf.double))
for shape, std_dev in self.w_shapes])
for s in ['bu', 'bf', 'bo', 'bc']:
setattr(self, s, [tf.Variable(tf.random.normal(
stddev=std_dev,
shape=shape,
dtype=tf.double))
for shape, std_dev in self.b_shapes])
all_weights = []
for w in [self.wu, self.bu, self.wf, self.bf,
self.wo, self.bo, self.wc, self.bc]:
all_weights.extend(w)
return all_weights
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment