Skip to content

Commit a2d17b4

Browse files
authored
Update rbm.py
1 parent 3108ca4 commit a2d17b4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

models/rbm.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@ def get_reconstruction_cost(self):
139139
reduce_activation_v_clip = tf.clip_by_value(1.0 - activation_v, clip_value_min=1e-30, clip_value_max=1.0)
140140
cross_entropy = -tf.reduce_mean(tf.reduce_sum(self.input*(tf.log(activation_v_clip)) +
141141
(1.0 - self.input)*(tf.log(reduce_activation_v_clip)), axis=1))
142-
return cross_entropy
142+
return cross_entropy
143+
def reconstruct(self, v):
144+
"""Reconstruct the original input by RBM"""
145+
h = self.propup(v)
146+
return self.propdown(h)
143147

144148
if __name__ == "__main__":
145149
# mnist examples

0 commit comments

Comments
 (0)