提交 ffcb4dac 编写于 作者: M Megvii Engine Team

style(mge): change the pad opr doc and format

GitOrigin-RevId: 7b20e965198c42e8bda92b42865ed649c25c06c2
上级 43cb305e
......@@ -1595,24 +1595,16 @@ def sliding_window_transpose(
def pad(
src: Tensor,
pad_witdth: Tuple[Tuple[int, int], ...],
mode: str = "CONSTANT",
mode: str = "constant",
constant_value: float = 0.0,
) -> Tensor:
"""
pad
Pad is python warpper for padding opr in megbrain, can padding in random one of the max 7 dimensions.
Supported constant, edge(replicate) and reflect mode, constatnt is the default mode.
"""
p_offsets = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
assert mode in [
"constant",
"CONSTANT",
"edge",
"EDGE",
"replicate",
"REPLICATE",
"reflect",
"REFLECT",
]
assert mode.lower() in ["constant", "edge", "replicate", "reflect"]
if mode.lower() == "edge":
mode = "replicate"
......
......@@ -5,10 +5,15 @@ from .module import Module
class Pad(Module):
"""
Pad is python warpper for padding opr in megbrain, can padding in random one of the max 7 dimensions.
Supported constant, edge(replicate) and reflect mode, constatnt is the default mode.
"""
def __init__(
self,
pad_witdth: Tuple[Tuple[int, int], ...],
mode: str = "CONSTANT",
mode: str = "constant",
constant_val: float = 0.0,
):
super().__init__()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册