Skip to content

Commit a4e5704

Browse files
authored
Merge branch 'master' into new_data_format_fixed
2 parents e7b399a + 38ee333 commit a4e5704

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

tensorlayer/layers/embedding.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,8 @@ def forward(self, inputs, use_nce_loss=None):
284284
The nce_cost is returned only if the nce_loss is used.
285285
"""
286286

287-
if isinstance(inputs, list):
288-
outputs = tf.nn.embedding_lookup(params=self.embeddings, ids=inputs[0])
289-
else:
290-
outputs = tf.nn.embedding_lookup(params=self.embeddings, ids=inputs)
287+
ids = inputs[0] if isinstance(inputs, list) else inputs
288+
outputs = tf.nn.embedding_lookup(params=self.embeddings, ids=ids)
291289

292290
if use_nce_loss is True and not self.activate_nce_loss:
293291
raise AttributeError(

0 commit comments

Comments
 (0)