mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-19 22:25:44 +08:00
Switch to ruff (#1939)
* `isort` -> `ruff` * `pylint` -> `ruff` * Remove line * More minor cleanup * Better documentation for rules we are enabling * Fix gitignore, run black * vscode settings --------- Co-authored-by: Matt Tancik <mattt4001@gmail.com>
This commit is contained in:
1 parent
814db32ec4
commit
d542646c72
79 files changed
+158
-237
No files matched your search
@@ -518,18 +518,18 @@ def tv_loss(grids: Float[Tensor, "grids feature_dim row column"]) -> Float[Tenso
|
||||
return 2 * (h_tv / h_tv_count + w_tv / w_tv_count) / number_of_grids
|
||||
|
||||
|
||||
class _GradientScaler(torch.autograd.Function): # typing: ignore, pylint: disable=abstract-method
|
||||
class _GradientScaler(torch.autograd.Function): # typing: ignore
|
||||
"""
|
||||
Scale gradients by a constant factor.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def forward(ctx, value, scaling): # pylint: disable=arguments-differ
|
||||
def forward(ctx, value, scaling):
|
||||
ctx.save_for_backward(scaling)
|
||||
return value, scaling
|
||||
|
||||
@staticmethod
|
||||
def backward(ctx, output_grad, grad_scaling): # pylint: disable=arguments-differ
|
||||
def backward(ctx, output_grad, grad_scaling):
|
||||
(scaling,) = ctx.saved_tensors
|
||||
return output_grad * scaling, grad_scaling
|
||||
|
||||
|
||||
@@ -423,7 +423,6 @@ class VolumetricSampler(Sampler):
|
||||
"The VolumetricSampler fuses sample generation and density check together. Please call forward() directly."
|
||||
)
|
||||
|
||||
# pylint: disable=arguments-differ
|
||||
def forward(
|
||||
self,
|
||||
ray_bundle: RayBundle,
|
||||
|
||||
@@ -46,7 +46,7 @@ BACKGROUND_COLOR_OVERRIDE: Optional[Float[Tensor, "3"]] = None
|
||||
@contextlib.contextmanager
|
||||
def background_color_override_context(mode: Float[Tensor, "3"]) -> Generator[None, None, None]:
|
||||
"""Context manager for setting background mode."""
|
||||
global BACKGROUND_COLOR_OVERRIDE # pylint: disable=global-statement
|
||||
global BACKGROUND_COLOR_OVERRIDE
|
||||
old_background_color = BACKGROUND_COLOR_OVERRIDE
|
||||
try:
|
||||
BACKGROUND_COLOR_OVERRIDE = mode
|
||||
|
||||
Reference in new issue
Block a user