From 32af0082c78219c58d4a0a4683e8c6ba60b08b58 Mon Sep 17 00:00:00 2001 From: Matt Tancik Date: Wed, 20 Apr 2022 14:10:59 -0700 Subject: [PATCH] Fix linting issues --- .vscode/settings.json | 2 +- mattport/nerf/trainer.py | 2 +- tests/nerf/field_modules/test_field_outputs.py | 7 +++---- tests/nerf/test_sampler.py | 5 +---- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 599af5b4b..ab9efac9c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -32,6 +32,6 @@ "--good-names=e,c,i,j,x,y,lr,K,fx,fy,cx,cy,H,W,ts,t,u", "--disable=too-many-arguments", "--disable=fixme", - "--disable-msg=too-many-locals" + "--disable=too-many-locals" ], } \ No newline at end of file diff --git a/mattport/nerf/trainer.py b/mattport/nerf/trainer.py index ea67e9b24..129c81fdf 100644 --- a/mattport/nerf/trainer.py +++ b/mattport/nerf/trainer.py @@ -116,7 +116,7 @@ class Trainer: def train_epoch(self): """_summary_""" num_iters = 100 - for step in tqdm(range(num_iters)): + for _ in tqdm(range(num_iters)): batch = next(iter(self.train_dataloader)) self.train_iteration(batch) # TODO(): proper saving with the correct directory path and such diff --git a/tests/nerf/field_modules/test_field_outputs.py b/tests/nerf/field_modules/test_field_outputs.py index 5491b698e..d6303ffca 100644 --- a/tests/nerf/field_modules/test_field_outputs.py +++ b/tests/nerf/field_modules/test_field_outputs.py @@ -1,7 +1,6 @@ """ Field output tests """ -import pytest import torch from torch import nn @@ -19,7 +18,7 @@ def test_field_output(): assert render_head.get_out_dim() == out_dim x = torch.ones((9, in_dim)) - y = render_head(x) + render_head(x) def test_density_output(): @@ -29,7 +28,7 @@ def test_density_output(): assert density_head.get_out_dim() == 1 x = torch.ones((9, in_dim)) - y = density_head(x) + density_head(x) def test_rgb_output(): @@ -39,4 +38,4 @@ def test_rgb_output(): assert rgb_head.get_out_dim() == 3 x = torch.ones((9, in_dim)) - y = rgb_head(x) + rgb_head(x) diff --git a/tests/nerf/test_sampler.py b/tests/nerf/test_sampler.py index d2da38336..bda6d2785 100644 --- a/tests/nerf/test_sampler.py +++ b/tests/nerf/test_sampler.py @@ -1,12 +1,9 @@ """ Test samplers """ -from random import uniform -import pytest import torch from mattport.nerf.sampler import PDFSampler, UniformSampler -from mattport.structures.cameras import Rays from mattport.structures.rays import RayBundle @@ -45,7 +42,7 @@ def test_pdf_sampler(): # Just check that it doesn't crash. Need to add some actual tests. pdf_sampler = PDFSampler(num_samples) - ray_samples = pdf_sampler(ray_bundle, coarse_ray_samples, density, num_samples) + pdf_sampler(ray_bundle, coarse_ray_samples, density, num_samples) # TODO Tancik: Add more precise tests