Skip to content

Instantly share code, notes, and snippets.

@lazuxd
Created July 20, 2021 06:15
Show Gist options
  • Save lazuxd/663971033be87085772c824c0832ccc6 to your computer and use it in GitHub Desktop.
Save lazuxd/663971033be87085772c824c0832ccc6 to your computer and use it in GitHub Desktop.
def _init_gru(self):
for s in ['wr', 'wu', 'wa']:
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 ['br', 'bu', 'ba']:
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.wr, self.br, self.wu, self.bu, self.wa, self.ba]:
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