Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pytorch3d/csrc/ball_query/ball_query.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ inline std::tuple<at::Tensor, at::Tensor> BallQuery(
AT_ERROR("Not compiled with GPU support.");
#endif
}
CHECK_CPU(p1);
CHECK_CPU(p2);
return BallQueryCpu(
p1.contiguous(),
p2.contiguous(),
Expand Down
5 changes: 5 additions & 0 deletions pytorch3d/csrc/blending/sigmoid_alpha_blend.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ at::Tensor SigmoidAlphaBlendBackward(
AT_ERROR("Not compiled with GPU support.");
#endif
}
CHECK_CPU(distances);
CHECK_CPU(pix_to_face);
CHECK_CPU(alphas);
CHECK_CPU(grad_alphas);

return SigmoidAlphaBlendBackwardCpu(
grad_alphas, alphas, distances, pix_to_face, sigma);
}
8 changes: 8 additions & 0 deletions pytorch3d/csrc/compositing/alpha_composite.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ torch::Tensor alphaCompositeForward(
AT_ERROR("Not compiled with GPU support");
#endif
} else {
CHECK_CPU(features);
CHECK_CPU(alphas);
CHECK_CPU(points_idx);
return alphaCompositeCpuForward(features, alphas, points_idx);
}
}
Expand Down Expand Up @@ -101,6 +104,11 @@ std::tuple<torch::Tensor, torch::Tensor> alphaCompositeBackward(
AT_ERROR("Not compiled with GPU support");
#endif
} else {
CHECK_CPU(grad_outputs);
CHECK_CPU(features);
CHECK_CPU(alphas);
CHECK_CPU(points_idx);

return alphaCompositeCpuBackward(
grad_outputs, features, alphas, points_idx);
}
Expand Down
9 changes: 9 additions & 0 deletions pytorch3d/csrc/compositing/norm_weighted_sum.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ torch::Tensor weightedSumNormForward(
AT_ERROR("Not compiled with GPU support");
#endif
} else {
CHECK_CPU(features);
CHECK_CPU(alphas);
CHECK_CPU(points_idx);

return weightedSumNormCpuForward(features, alphas, points_idx);
}
}
Expand Down Expand Up @@ -100,6 +104,11 @@ std::tuple<torch::Tensor, torch::Tensor> weightedSumNormBackward(
AT_ERROR("Not compiled with GPU support");
#endif
} else {
CHECK_CPU(grad_outputs);
CHECK_CPU(features);
CHECK_CPU(alphas);
CHECK_CPU(points_idx);

return weightedSumNormCpuBackward(
grad_outputs, features, alphas, points_idx);
}
Expand Down
8 changes: 8 additions & 0 deletions pytorch3d/csrc/compositing/weighted_sum.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ torch::Tensor weightedSumForward(
AT_ERROR("Not compiled with GPU support");
#endif
} else {
CHECK_CPU(features);
CHECK_CPU(alphas);
CHECK_CPU(points_idx);
return weightedSumCpuForward(features, alphas, points_idx);
}
}
Expand All @@ -98,6 +101,11 @@ std::tuple<torch::Tensor, torch::Tensor> weightedSumBackward(
AT_ERROR("Not compiled with GPU support");
#endif
} else {
CHECK_CPU(grad_outputs);
CHECK_CPU(features);
CHECK_CPU(alphas);
CHECK_CPU(points_idx);

return weightedSumCpuBackward(grad_outputs, features, alphas, points_idx);
}
}
6 changes: 6 additions & 0 deletions pytorch3d/csrc/face_areas_normals/face_areas_normals.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ std::tuple<at::Tensor, at::Tensor> FaceAreasNormalsForward(
AT_ERROR("Not compiled with GPU support.");
#endif
}
CHECK_CPU(verts);
CHECK_CPU(faces);
return FaceAreasNormalsForwardCpu(verts, faces);
}

Expand All @@ -80,5 +82,9 @@ at::Tensor FaceAreasNormalsBackward(
AT_ERROR("Not compiled with GPU support.");
#endif
}
CHECK_CPU(grad_areas);
CHECK_CPU(grad_normals);
CHECK_CPU(verts);
CHECK_CPU(faces);
return FaceAreasNormalsBackwardCpu(grad_areas, grad_normals, verts, faces);
}
4 changes: 4 additions & 0 deletions pytorch3d/csrc/utils/pytorch3d_cutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@
#define CHECK_CONTIGUOUS_CUDA(x) \
CHECK_CUDA(x); \
CHECK_CONTIGUOUS(x)
#define CHECK_CPU(x) \
TORCH_CHECK( \
x.device().type() == torch::kCPU, \
"Cannot use CPU implementation: " #x " not on CPU.")
Loading