mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-04 14:58:55 +08:00
fix axis arg to dim for pytorch funcs
This commit is contained in:
1 parent
ff4f1bb421
commit
1f38240212
6 files changed
+15
-13
No files matched your search
+2
-1
@@ -15,6 +15,7 @@
|
||||
""" Math Helper Functions """
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
import torch
|
||||
from torchtyping import TensorType
|
||||
|
||||
@@ -117,7 +118,7 @@ def compute_3d_gaussian(
|
||||
|
||||
dir_outer_product = directions[..., :, None] * directions[..., None, :]
|
||||
eye = torch.eye(directions.shape[-1], device=directions.device)
|
||||
dir_mag_sq = torch.clamp(torch.sum(directions**2, axis=-1, keepdim=True), min=1e-10)
|
||||
dir_mag_sq = torch.clamp(torch.sum(directions**2, dim=-1, keepdim=True), min=1e-10)
|
||||
null_outer_product = eye - directions[..., :, None] * (directions / dir_mag_sq)[..., None, :]
|
||||
dir_cov_diag = dir_variance[..., None] * dir_outer_product[..., :, :]
|
||||
radius_cov_diag = radius_variance[..., None] * null_outer_product[..., :, :]
|
||||
|
||||
@@ -171,7 +171,7 @@ def get_sphere(
|
||||
x = torch.cos(theta) * torch.sin(phi)
|
||||
y = torch.cos(theta) * torch.cos(phi)
|
||||
z = torch.sin(theta)
|
||||
pts = torch.stack((x, y, z), axis=-1)
|
||||
pts = torch.stack((x, y, z), dim=-1)
|
||||
|
||||
pts *= radius
|
||||
if center is not None:
|
||||
@@ -220,10 +220,10 @@ def get_gaussian_ellipsiod(
|
||||
x = torch.cos(theta) * torch.sin(phi)
|
||||
y = torch.cos(theta) * torch.cos(phi)
|
||||
z = torch.sin(theta)
|
||||
pts = torch.stack((x, y, z), axis=-1)
|
||||
pts = torch.stack((x, y, z), dim=-1)
|
||||
|
||||
eigenvals, eigenvecs = torch.linalg.eigh(cov)
|
||||
idx = torch.sum(cov, axis=0).argsort()
|
||||
idx = torch.sum(cov, dim=0).argsort()
|
||||
idx = eigenvals[idx].argsort()
|
||||
eigenvals = eigenvals[idx]
|
||||
eigenvecs = eigenvecs[:, idx]
|
||||
|
||||
Reference in new issue
Block a user