"projects/git@developer.sourcefind.cn:OpenDAS/pytorch3d.git" did not exist on "03562d87f5afd4004faff4f5d9a90261a62c8c7d"
Commit a607dd06 authored by Jeremy Reizenstein's avatar Jeremy Reizenstein Committed by Facebook GitHub Bot
Browse files

better implicit function #channels errors

Summary: More helpful errors when the output channels aren't 1 for density and 3 for color

Reviewed By: shapovalov

Differential Revision: D40341088

fbshipit-source-id: 6074bf7fefe11c8e60fee4db2760b776419bcfee
parent 17bc043a
......@@ -362,6 +362,11 @@ class ViewMetrics(ViewMetricsBase):
def _rgb_metrics(images, images_pred, masks, masks_pred, masks_crop):
assert masks_crop is not None
if images.shape[1] != images_pred.shape[1]:
raise ValueError(
f"Network output's RGB images had {images_pred.shape[1]} "
f"channels. {images.shape[1]} expected."
)
rgb_squared = ((images_pred - images) ** 2).mean(dim=1, keepdim=True)
rgb_loss = utils.huber(rgb_squared, scaling=0.03)
crop_mass = masks_crop.sum().clamp(1.0)
......
......@@ -215,6 +215,7 @@ def _check_raymarcher_inputs(
if density_1d and rays_densities.shape[-1] != 1:
raise ValueError(
"The size of the last dimension of rays_densities has to be one."
+ f" Got shape {rays_densities.shape}."
)
rays_shape = rays_densities.shape[:-1]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment