Fix tensorflow tests
@@ -17,16 +17,26 @@ def history():
wandb.run = wandb.wandb_run.Run.from_environment_or_defaults()
wandb.util.mkdir_exists_ok(wandb.run.dir)
yield wandb.run.history
+ wandb.run = None
def test_tf_summary():
summary = wandb_tensorflow.tf_summary_to_dict(SUMMARY_PB)
- pprint.pprint(summary)
images = summary['input_reshape_input_image']
del summary['input_reshape_input_image']
+ histo_keys = ['layer1/activations', 'layer1/biases/summaries/histogram',
+ 'layer1/weights/summaries/histogram', 'layer2/Wx_plus_b/pre_activations',
+ 'layer2/activations', 'layer2/biases/summaries/histogram',
+ 'layer2/weights/summaries/histogram', 'layer1/Wx_plus_b/pre_activations']
+ histos = [summary[k] for k in histo_keys]
+ for k in histo_keys:
+ del summary[k]
+
+ pprint.pprint(summary)
assert len(images) == 10
assert all(isinstance(img, wandb.Image) for img in images)
+ assert all(isinstance(hist, wandb.Histogram) for hist in histos)
assert summary == {
'accuracy_1': 0.8799999952316284,
'cross_entropy_1': 0.37727174162864685,
@@ -61,7 +71,6 @@ def test_tf_summary_in_history(history):
def test_hook(history):
- with CliRunner().isolated_filesystem():
g1 = tensorflow.Graph()
with g1.as_default():
c1 = tensorflow.constant(42)
