Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions tripy/nvtripy/frontend/module/conv/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
# limitations under the License.
from collections.abc import Sequence
from dataclasses import dataclass
from typing import Optional
from typing import Optional, Union

from nvtripy import utils
from nvtripy.common import datatype
from nvtripy.common.exception import raise_error
from nvtripy.frontend.dimension_size import DimensionSize
from nvtripy.frontend.module.module import Module
from nvtripy.frontend.module.parameter import DefaultParameter
from nvtripy.frontend.ops import utils as op_utils
Expand All @@ -39,12 +40,12 @@ class ConvBase(Module):

def __init__(
self,
in_channels: int,
out_channels: int,
kernel_dims: Sequence[int],
in_channels: Union[int, DimensionSize],
Copy link
Collaborator

Choose a reason for hiding this comment

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

How would this work? TRT expects the channel dimension to be known at build-time.

Copy link
Collaborator

@yizhuoz004 yizhuoz004 Aug 14, 2025

Choose a reason for hiding this comment

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

I think it has to be a known constant because the in_channels decides the weight's shape. You should be able to get a static number for it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Then we'd probably want to explicitly evaluate it in the user code.

out_channels: Union[int, DimensionSize],
kernel_dims: Union[Sequence[int], Sequence[DimensionSize]],
padding: Sequence[Sequence[int]] = None,
stride: Sequence[int] = None,
groups: int = None,
groups: Union[int, DimensionSize] = None,
dilation: Sequence[int] = None,
bias: bool = True,
dtype: datatype.dtype = datatype.float32,
Expand Down
11 changes: 6 additions & 5 deletions tripy/nvtripy/frontend/module/conv/conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@

from collections.abc import Sequence
from dataclasses import dataclass
from typing import Optional, Tuple
from typing import Optional, Tuple, Union

from nvtripy import export
from nvtripy.common import datatype
from nvtripy.frontend.dimension_size import DimensionSize
from nvtripy.frontend.module.conv.base import ConvBase
from nvtripy.frontend.module.conv.utils import conv_deconv_helper
from nvtripy.frontend.module.parameter import DefaultParameter
Expand Down Expand Up @@ -116,13 +117,13 @@ class Conv(ConvBase):

def __init__(
self,
in_channels: int,
out_channels: int,
kernel_dims: Sequence[int],
in_channels: Union[int, DimensionSize],
out_channels: Union[int, DimensionSize],
kernel_dims: Union[Sequence[int], Sequence[DimensionSize]],
stride: Optional[Sequence[int]] = None,
padding: Optional[Sequence[Tuple[int, int]]] = None,
dilation: Optional[Sequence[int]] = None,
groups: Optional[int] = None,
groups: Optional[Union[int, DimensionSize]] = None,
bias: bool = True,
dtype: datatype.dtype = datatype.float32,
) -> None:
Expand Down