This repository was archived by the owner on Jul 7, 2023. It is now read-only.
[UT] small bugs in ut_function when one uses data length = 1 #1213
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
I found and fixed small bugs in UT implements in special case
length=1
foruniversal_transformer_util.py
.Addition to that, I fixed an operation by having some codes out of loop which looks meaningless iteration (this is not main).
Bugs Detail
I found bugs on a special case in
universal_transformer_util.py
:ut_function
without axis make the dimensions unknown and fail successive operationThe flow for L1136 is below:
[batch_size, length, channel]
as mentioned in comment at L1110[batch_size, length, 1]
incommon_layers.dense
at L1129p
is[batch_size, length]
byp = tf.squeeze(p)
at L1136In this case, the shape of
p
would be unknown iflength = 1
after squeeze operation, and that may makes successive operation fail.Modification Detail
There are 2 modifications:
tf.squeeze
in ut_functionreduce_mean
operation beforesqueeze
.new_state.set_shape(state_shape)
out of loop because it looks meaningless 👀It's ok to revert latter one because it is not a main fix.