Commit 9b187704 authored by Duc Nguyen's avatar Duc Nguyen Committed by GitHub
Browse files

Change key of type 'tuple' to 'str'

dictionary having both 'tuple' and 'str' keys cannot be 'sorted'
parent 1b2c67af
......@@ -81,7 +81,7 @@ class BatchQueue(object):
{key: tensor.get_shape() for key, tensor in tensor_dict.iteritems()})
# Remember runtime shapes to unpad tensors after batching.
runtime_shapes = collections.OrderedDict(
{(key, 'runtime_shapes'): tf.shape(tensor)
{(key + '_runtime_shapes'): tf.shape(tensor)
for key, tensor in tensor_dict.iteritems()})
all_tensors = tensor_dict
all_tensors.update(runtime_shapes)
......@@ -112,8 +112,8 @@ class BatchQueue(object):
for key, batched_tensor in batched_tensors.iteritems():
unbatched_tensor_list = tf.unstack(batched_tensor)
for i, unbatched_tensor in enumerate(unbatched_tensor_list):
if isinstance(key, tuple) and key[1] == 'runtime_shapes':
shapes[(key[0], i)] = unbatched_tensor
if '_runtime_shapes' in key:
shapes[(key[:-15], i)] = unbatched_tensor
else:
tensors[(key, i)] = unbatched_tensor
......
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