Skip to content

Commit

Permalink
fix interval
Browse files Browse the repository at this point in the history
  • Loading branch information
seiriosPlus committed Sep 8, 2020
1 parent 111945e commit fe18cfd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions python/paddle/nn/functional/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ def embedding(x, weight, padding_idx=None, sparse=False, name=None):
padding_idx = -1 if padding_idx is None else padding_idx if padding_idx >= 0 else (
weight.shape[0] + padding_idx)

if padding_idx >= weight.shape[0] or padding_idx <= -weight.shape[0]:
raise ValueError("padding_idx must be within [-{}, {}]".format(
if padding_idx >= weight.shape[0] or padding_idx < -weight.shape[0]:
raise ValueError("padding_idx must be within [-{}, {})".format(
weight.shape[0], weight.shape[0]))

helper.append_op(
Expand Down
4 changes: 2 additions & 2 deletions python/paddle/nn/layer/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1673,8 +1673,8 @@ def __init__(self,
if self._embedding_dim <= 0:
raise ValueError("embedding_dim must be gather than 0")

if self._padding_idx >= num_embeddings or self._padding_idx <= -num_embeddings:
raise ValueError("padding_idx must be within [-{}, {}]".format(
if self._padding_idx >= num_embeddings or self._padding_idx < -num_embeddings:
raise ValueError("padding_idx must be within [-{}, {})".format(
num_embeddings, num_embeddings))

self._dtype = self._helper.get_default_dtype()
Expand Down

1 comment on commit fe18cfd

@paddle-bot-old
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulation! Your pull request passed all required CI. You could ask reviewer(s) to approve and merge. 🎉

Please sign in to comment.