Commit b3247557 authored by Dheera Venkatraman's avatar Dheera Venkatraman
Browse files

add flag for saving images to summary; strings moved to common.py'

parents 75c931fd 2041d5ca
...@@ -136,6 +136,13 @@ class OpsTestPadToMultiple(tf.test.TestCase): ...@@ -136,6 +136,13 @@ class OpsTestPadToMultiple(tf.test.TestCase):
padded_tensor_out = sess.run(padded_tensor) padded_tensor_out = sess.run(padded_tensor)
self.assertEqual((1, 2, 2, 1), padded_tensor_out.shape) self.assertEqual((1, 2, 2, 1), padded_tensor_out.shape)
def test_non_square_padding(self):
tensor = tf.constant([[[[0.], [0.]]]])
padded_tensor = ops.pad_to_multiple(tensor, 2)
with self.test_session() as sess:
padded_tensor_out = sess.run(padded_tensor)
self.assertEqual((1, 2, 2, 1), padded_tensor_out.shape)
def test_padding(self): def test_padding(self):
tensor = tf.constant([[[[0.], [0.]], [[0.], [0.]]]]) tensor = tf.constant([[[[0.], [0.]], [[0.], [0.]]]])
padded_tensor = ops.pad_to_multiple(tensor, 4) padded_tensor = ops.pad_to_multiple(tensor, 4)
......
...@@ -42,7 +42,7 @@ def filter_variables(variables, filter_regex_list, invert=False): ...@@ -42,7 +42,7 @@ def filter_variables(variables, filter_regex_list, invert=False):
a list of filtered variables. a list of filtered variables.
""" """
kept_vars = [] kept_vars = []
variables_to_ignore_patterns = filter(None, filter_regex_list) variables_to_ignore_patterns = list(filter(None, filter_regex_list))
for var in variables: for var in variables:
add = True add = True
for pattern in variables_to_ignore_patterns: for pattern in variables_to_ignore_patterns:
......
...@@ -282,9 +282,10 @@ ...@@ -282,9 +282,10 @@
}, },
"cell_type": "code", "cell_type": "code",
"source": [ "source": [
"if tf.test.is_gpu_available() > 0:\n", "if tf.test.is_gpu_available():\n",
" with tf.device(tf.test.gpu_device_name()):\n", " with tf.device(tf.test.gpu_device_name()):\n",
" print(tf.matmul(A, A))" " B = tf.constant([[2.0, 0.0], [0.0, 3.0]])\n",
" print(tf.matmul(B, B))"
], ],
"execution_count": 0, "execution_count": 0,
"outputs": [] "outputs": []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment