diff --git a/.github/workflows/code_checks.yml b/.github/workflows/code_checks.yml index b073d6757..09d0a7f94 100644 --- a/.github/workflows/code_checks.yml +++ b/.github/workflows/code_checks.yml @@ -34,4 +34,4 @@ jobs: pylint mattport --max-line-length=120 --generated-members=numpy.*,torch.*,cv2.*,cv.* --good-names=e,c,i,j,x,y,lr,K,fx,fy,cx,cy,H,W --disable=too-many-arguments --disable=fixme - name: Test with pytest run: | - pytest tests --ignore tests/nerf/test_ray_generator.py + pytest tests --ignore tests/nerf/test_ray_generator.py --typeguard-packages=mattport --torchtyping-patch-typeguard diff --git a/.vscode/settings.json b/.vscode/settings.json index 577383dfe..852ee82eb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,7 +18,9 @@ "--src=${workspaceFolder}" ], "python.testing.pytestArgs": [ - "tests" + "--ignore=tests/nerf/test_ray_generator.py", + "--typeguard-packages=mattport", + "--torchtyping-patch-typeguard" ], "python.testing.unittestEnabled": false, "python.testing.pytestEnabled": true, diff --git a/mattport/nerf/renderers.py b/mattport/nerf/renderers.py index 805920db2..1e78e04aa 100644 --- a/mattport/nerf/renderers.py +++ b/mattport/nerf/renderers.py @@ -22,13 +22,13 @@ class Renderer(nn.Module): def forward( self, - field_output_dict: Dict["str", TensorType[..., "num_samples", "features"]], + field_output_dict: Dict["str", TensorType[..., "num_samples", -1]], deltas: TensorType[..., "num_samples"], ) -> TensorType[..., "out_dim"]: """Composite samples along ray and render image Args: - in_tensor (TensorType[..., "num_samples", "features"]): feature for each sample + in_tensor (TensorType[..., "num_samples", -1]): feature for each sample deltas (TensorType[..., "num_samples"]): depth of each sample Returns: @@ -50,13 +50,13 @@ class RGB(Renderer): def forward( self, - field_output_dict: Dict["str", TensorType[..., "num_samples", "features"]], + field_output_dict: Dict[str, TensorType[..., "num_samples", -1]], deltas: TensorType[..., "num_samples"], ) -> TensorType[..., "out_dim"]: """Composite samples along ray and render color image Args: - in_tensor (TensorType[..., "num_samples", 3]): RGB for each sample + in_tensor (TensorType[..., "num_samples", -1]): RGB for each sample deltas (TensorType[..., "num_samples"]): depth influence for each sample Returns: @@ -88,7 +88,7 @@ class Depth(Renderer): def forward( self, - field_output_dict: Dict["str", TensorType[..., "num_samples", "features"]], + field_output_dict: Dict["str", TensorType[..., "num_samples", -1]], deltas: TensorType[..., "num_samples"], ) -> TensorType[..., "out_dim"]: raise NotImplementedError