Skip to content

Conversation

@LittleHeroZZZX
Copy link
Contributor

@LittleHeroZZZX LittleHeroZZZX commented Oct 30, 2025

PR Category

User Experience

PR Types

New features

Description

  1. 新增如下 API 并润色原 Pad 1d/2d/3d 文档:
  • nn.ConstantPad1d/2d/3d
  • nn.ReflectionPad1d/2d/3d
  • nn.ReplicationPad1d/2d/3d
  1. 使用类继承重构 Pad 系列 Layers,减少维护成本

PaConvert 测试:

image

@paddle-bot
Copy link

paddle-bot bot commented Oct 30, 2025

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@codecov-commenter
Copy link

codecov-commenter commented Oct 30, 2025

Codecov Report

❌ Patch coverage is 97.22222% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@b009972). Learn more about missing BASE report.

Files with missing lines Patch % Lines
python/paddle/nn/layer/common.py 96.49% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop   #76136   +/-   ##
==========================================
  Coverage           ?   97.22%           
==========================================
  Files              ?        2           
  Lines              ?       72           
  Branches           ?        0           
==========================================
  Hits               ?       70           
  Misses             ?        2           
  Partials           ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LittleHeroZZZX
Copy link
Contributor Author

/re-run all-failed

from .utils.spectral_norm_hook import spectral_norm # noqa: F401

SiLU = Silu
ReflectionPad1d = ReflectionPad1D
Copy link
Contributor

Choose a reason for hiding this comment

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

你也可以conv2d=Conv2D那些也挪出来,统一放一个位置。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

return f'padding={self.padding}, value={self.value}, data_format={self._data_format}{name_str}'


class ReplicationPad1D(Layer):
Copy link
Contributor

Choose a reason for hiding this comment

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

1D是不是可以都继承下class PadD
2D都继承Pad2D
3D都继承Pad3D

增加代码复用,减少维护成本。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

zhwesky2010
zhwesky2010 previously approved these changes Nov 3, 2025
Copy link
Contributor

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

LGTM

@zhwesky2010
Copy link
Contributor

zhwesky2010 commented Nov 3, 2025

infoflow 2025-11-03 12-16-13

之前有点遗漏,这三个API也补上吧。可以这个PR或者下个PR提

@LittleHeroZZZX
Copy link
Contributor Author

infoflow 2025-11-03 12-16-13 之前有点遗漏,这三个API也补上吧。可以这个PR或者下个PR提

Done

@LittleHeroZZZX
Copy link
Contributor Author

/re-run all-failed

zhwesky2010
zhwesky2010 previously approved these changes Nov 4, 2025
Copy link
Contributor

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

LGTM

@LittleHeroZZZX
Copy link
Contributor Author

@SigureMo 求 Review ~

@zhwesky2010 zhwesky2010 requested a review from SigureMo November 4, 2025 10:36
@LittleHeroZZZX
Copy link
Contributor Author

/re-run all-failed

Copy link
Contributor

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

LGTM

@zhwesky2010 zhwesky2010 changed the title [API Compatibility] Add nn.Constant/Reflection/Replication Pad layers [API Compatibility] Add nn.Constant/Reflection/Replication/Circular Pad layers Nov 5, 2025
Copy link
Contributor

@wanghuancoder wanghuancoder left a comment

Choose a reason for hiding this comment

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

LGTM for skip

Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

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

LGTM

@zhwesky2010 zhwesky2010 merged commit 41c476b into PaddlePaddle:develop Nov 5, 2025
123 of 130 checks passed
AlAuAu pushed a commit to AlAuAu/Paddle that referenced this pull request Nov 6, 2025
…ad layers (PaddlePaddle#76136)

* Add nn.Constant/Reflection/Replication Pad layers

* Refine on comment: Rename 1d/2d/3d to 1D2D3D

* Fix sample code

* Fix test error

* Rerun CI

* Refactor pad layers

* Fix zeropad test

* Fix unittest

* Add CircularPad1D/2D/3D

* Add CircularPad1D/2D/3D

* Skip circular pad 3d test on xpu

* Skip circular pad ut on XPU

* correct return type of _npairs

* correct return type of _npairs with concrete type

Co-authored-by: Nyakku Shigure <[email protected]>

---------

Co-authored-by: Nyakku Shigure <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants