Skip to content

Commit

Permalink
bug_fix in length()
Browse files Browse the repository at this point in the history
Thanks to Georgi Nakov for spotting it
  • Loading branch information
shanest committed Jan 30, 2018
1 parent 30efa5f commit 95909a6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions quant_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ def length(data):
a Tensor, of shape [data.shape[0]], containing the length
of each sequence
"""
data = tf.slice(data,
[0, 0, 0],
[-1, -1, quantifiers.Quantifier.num_chars])
used = tf.sign(tf.reduce_max(tf.abs(data), reduction_indices=2))
length = tf.reduce_sum(used, reduction_indices=1)
length = tf.cast(length, tf.int32)
return length
lengths = tf.reduce_sum(used, reduction_indices=1)
lengths = tf.cast(length, tf.int32)
return lengths


# TODO: some docs here, noting TF estimator stuff
Expand Down

0 comments on commit 95909a6

Please sign in to comment.