vllm.model_executor.layers.conv ¶
Conv Layer Class.
CausalConv2dLayer ¶
Bases: Conv2dLayer
A causal version of nn.Conv2d where each location in the 2D matrix would have no access to locations on its right or down All arguments are the same as nn.Conv2d except padding which should be set as None
Source code in vllm/model_executor/layers/conv.py
__init__ ¶
__init__(
in_channels: int,
out_channels: int,
kernel_size: int,
stride: int,
padding: int = 0,
dilation: int = 1,
groups: int = 1,
bias: bool = True,
padding_mode: str = "zeros",
*,
params_dtype: dtype | None = None,
) -> None
Source code in vllm/model_executor/layers/conv.py
Conv2dLayer ¶
Bases: ConvLayerBase
Conv layer with Conv2d.
Source code in vllm/model_executor/layers/conv.py
_forward_conv ¶
Source code in vllm/model_executor/layers/conv.py
_forward_mulmat ¶
Source code in vllm/model_executor/layers/conv.py
forward_cuda ¶
forward_native ¶
Expected input shape: (batch_size, in_channels, height, width)
Source code in vllm/model_executor/layers/conv.py
Conv3dLayer ¶
Bases: ConvLayerBase
Conv layer with Conv3d.
Source code in vllm/model_executor/layers/conv.py
_forward_conv ¶
Source code in vllm/model_executor/layers/conv.py
_forward_mulmat ¶
Source code in vllm/model_executor/layers/conv.py
forward_cuda ¶
Source code in vllm/model_executor/layers/conv.py
forward_native ¶
Expected input shape: (batch_size, in_channels, time, height, width)
ConvLayerBase ¶
Bases: CustomOp
Conv layer base class.
Source code in vllm/model_executor/layers/conv.py
enable_linear instance-attribute ¶
enable_linear = (
kernel_size == stride
and not any(padding)
and groups == 1
)
weight instance-attribute ¶
weight = Parameter(
empty(
out_channels,
in_channels // groups,
*kernel_size,
dtype=params_dtype,
)
)
__init__ ¶
__init__(
in_channels: int,
out_channels: int,
kernel_size: int | tuple[int, ...],
stride: int | tuple[int, ...] = 1,
padding: int | tuple[int, ...] = 0,
dilation: int | tuple[int, ...] = 1,
groups: int = 1,
bias: bool = True,
padding_mode: str = "zeros",
*,
params_dtype: dtype | None = None,
) -> None