[Multimodal] Avoid extra d2d for encoder cudagraph with fused input norm (#56711)
Signed-off-by: Isotr0py <Isotr0py@outlook.com>
This commit is contained in:
@@ -195,6 +195,10 @@ class IdentityInputNorm(nn.Module):
|
||||
``visual_dtype`` here.
|
||||
"""
|
||||
|
||||
@property
|
||||
def input_dtype(self) -> torch.dtype | None:
|
||||
return None
|
||||
|
||||
def forward(
|
||||
self, pixel_values: torch.Tensor, visual_dtype: torch.dtype
|
||||
) -> torch.Tensor:
|
||||
@@ -251,6 +255,10 @@ class FusedMMInputNorm(CustomOp):
|
||||
self.register_buffer("weight", (rescale_factor / std).to(device))
|
||||
self.register_buffer("bias", (-mean / std).to(device))
|
||||
|
||||
@property
|
||||
def input_dtype(self) -> torch.dtype | None:
|
||||
return torch.uint8
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Internal helpers shared by the platform-specific forward_* methods
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user