Skip to content

Commit

Permalink
ConcatenateWithOffset return inputs directly if the inputs is not a l…
Browse files Browse the repository at this point in the history
…ist (#1956)

* Retry to get table size to avoid ReadTimeout

* Return inputs if it is not a list
  • Loading branch information
workingloong committed Jun 4, 2020
1 parent 4cab523 commit a71edc4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion elasticdl_preprocessing/layers/concatenate_with_offset.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import tensorflow as tf


class ConcatenateWithOffset(tf.keras.layers.Concatenate):
class ConcatenateWithOffset(tf.keras.layers.Layer):
"""Layer that add offset to each id tensor in the input list and
then concatenate these tensors.
Expand Down Expand Up @@ -42,6 +42,9 @@ def call(self, inputs):

def _call_with_offsets(self, inputs):
ids_with_offset = []
if not isinstance(inputs, list):
return inputs

if len(self.offsets) != len(inputs):
raise ValueError(
"The offsets length is not equal to inputs length"
Expand Down

0 comments on commit a71edc4

Please sign in to comment.