Skip to content

Commit

Permalink
Reset TF graph
Browse files Browse the repository at this point in the history
  • Loading branch information
pawel-czyz committed Jun 2, 2018
1 parent 20bc347 commit fa2b837
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cce/calculate_weighted_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ def weight_loss(neighb_count: np.array, labels: np.array, weights: list) -> floa
float
calculated loss
"""
# reset graph before each run
tf.reset_default_graph()

num_data, num_labels = neighb_count.shape
label_counts = np.zeros([num_labels])
for label, count in Counter(labels).most_common():
Expand Down
3 changes: 3 additions & 0 deletions cce/optimize_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ def weight_optimizer(neighb_count, labels) -> (float, list):
list
weight for each label
"""
# reset graph before each run
tf.reset_default_graph()

num_data, num_labels = neighb_count.shape
label_counts = np.zeros([num_labels])
for label, count in Counter(labels).most_common():
Expand Down

0 comments on commit fa2b837

Please sign in to comment.