Skip to content

Commit

Permalink
fix a bug when embedding regularizer is applied on empty list (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-gecheng authored Sep 27, 2024
1 parent f4948af commit 696163f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions easy_rec/python/layers/input_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def get_plain_feature(self, features, group_name):
if is_embedding_column(col):
embedding_reg_lst.append(val)

if self._embedding_regularizer is not None:
if self._embedding_regularizer is not None and len(embedding_reg_lst) > 0:
regularizers.apply_regularization(
self._embedding_regularizer, weights_list=embedding_reg_lst)
return output_features, group_features
Expand Down Expand Up @@ -186,7 +186,7 @@ def get_sequence_feature(self, features, group_name):
seq_features.append((tmp_embedding, tmp_seq_len))
embedding_reg_lst.append(tmp_embedding)

if self._embedding_regularizer is not None:
if self._embedding_regularizer is not None and len(embedding_reg_lst) > 0:
regularizers.apply_regularization(
self._embedding_regularizer, weights_list=embedding_reg_lst)
return seq_features
Expand Down

0 comments on commit 696163f

Please sign in to comment.