Skip to content

"RuntimeError: Not implemented on the CPU." in deform_source_mesh_to_target_mesh.ipynb #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
semihcanturk opened this issue Feb 10, 2020 · 2 comments
Assignees

Comments

@semihcanturk
Copy link

When running the deform_source_mesh_to_target_mesh.ipynb tutorial, I encounter the following error in the 'sample_points_from_meshes()' function in the main optimization loop, cell 10 under section "3. Optimization loop":

RuntimeError                              Traceback (most recent call last)

<ipython-input-10-eaad4829c9f7> in <module>
     28 
     29     # We sample 5k points from the surface of each mesh
---> 30     sample_trg = sample_points_from_meshes(trg_mesh, 5000)
     31     sample_src = sample_points_from_meshes(new_src_mesh, 5000)
     32 

~/PycharmProjects/pytorch3d/pytorch3d/ops/sample_points_from_meshes.py in sample_points_from_meshes(meshes, num_samples, return_normals)
     53     with torch.no_grad():
     54         areas, _ = _C.face_areas_normals(
---> 55             verts, faces
     56         )  # Face areas can be zero.
     57         max_faces = meshes.num_faces_per_mesh().max().item()

RuntimeError: Not implemented on the CPU. (face_areas_normals at /Users/semo/PycharmProjects/pytorch3d/pytorch3d/csrc/face_areas_normals/face_areas_normals.h:35)
frame #0: c10::Error::Error(c10::SourceLocation, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 135 (0x12737c9e7 in libc10.dylib)
frame #1: face_areas_normals(at::Tensor, at::Tensor) + 857 (0x127e8e679 in _C.cpython-37m-darwin.so)
frame #2: std::__1::tuple<at::Tensor, at::Tensor> pybind11::detail::argument_loader<at::Tensor, at::Tensor>::call_impl<std::__1::tuple<at::Tensor, at::Tensor>, std::__1::tuple<at::Tensor, at::Tensor> (*&)(at::Tensor, at::Tensor), 0ul, 1ul, pybind11::detail::void_type>(std::__1::tuple<at::Tensor, at::Tensor> (*&)(at::Tensor, at::Tensor), std::__1::integer_sequence<unsigned long, 0ul, 1ul>, pybind11::detail::void_type&&) + 57 (0x127e96fa9 in _C.cpython-37m-darwin.so)
frame #3: void pybind11::cpp_function::initialize<std::__1::tuple<at::Tensor, at::Tensor> (*&)(at::Tensor, at::Tensor), std::__1::tuple<at::Tensor, at::Tensor>, at::Tensor, at::Tensor, pybind11::name, pybind11::scope, pybind11::sibling>(std::__1::tuple<at::Tensor, at::Tensor> (*&)(at::Tensor, at::Tensor), std::__1::tuple<at::Tensor, at::Tensor> (*)(at::Tensor, at::Tensor), pybind11::name const&, pybind11::scope const&, pybind11::sibling const&)::'lambda'(pybind11::detail::function_call&)::operator()(pybind11::detail::function_call&) const + 135 (0x127e96857 in _C.cpython-37m-darwin.so)
frame #4: pybind11::cpp_function::dispatcher(_object*, _object*, _object*) + 3088 (0x127e98350 in _C.cpython-37m-darwin.so)
frame #5: _PyMethodDef_RawFastCallKeywords + 537 (0x108117865 in Python)
frame #6: _PyCFunction_FastCallKeywords + 41 (0x108116dc0 in Python)
frame #7: call_function + 628 (0x1081ac2b4 in Python)
frame #8: _PyEval_EvalFrameDefault + 6767 (0x1081a528f in Python)
frame #9: _PyEval_EvalCodeWithName + 1698 (0x1081acb15 in Python)
frame #10: _PyFunction_FastCallKeywords + 212 (0x108116d88 in Python)
frame #11: call_function + 737 (0x1081ac321 in Python)
frame #12: _PyEval_EvalFrameDefault + 6922 (0x1081a532a in Python)
frame #13: _PyEval_EvalCodeWithName + 1698 (0x1081acb15 in Python)
frame #14: PyEval_EvalCode + 51 (0x1081a377d in Python)
frame #15: builtin_exec + 563 (0x1081a1207 in Python)
frame #16: _PyMethodDef_RawFastCallKeywords + 488 (0x108117834 in Python)
frame #17: _PyCFunction_FastCallKeywords + 41 (0x108116dc0 in Python)
frame #18: call_function + 628 (0x1081ac2b4 in Python)
frame #19: _PyEval_EvalFrameDefault + 6922 (0x1081a532a in Python)
frame #20: gen_send_ex + 244 (0x1081227e7 in Python)
frame #21: _PyEval_EvalFrameDefault + 17461 (0x1081a7c55 in Python)
frame #22: gen_send_ex + 244 (0x1081227e7 in Python)
frame #23: _PyEval_EvalFrameDefault + 17461 (0x1081a7c55 in Python)
frame #24: gen_send_ex + 244 (0x1081227e7 in Python)
frame #25: _PyMethodDef_RawFastCallKeywords + 583 (0x108117893 in Python)
frame #26: _PyMethodDescr_FastCallKeywords + 81 (0x10811c065 in Python)
frame #27: call_function + 782 (0x1081ac34e in Python)
frame #28: _PyEval_EvalFrameDefault + 6742 (0x1081a5276 in Python)
frame #29: function_code_fastcall + 106 (0x108117194 in Python)
frame #30: call_function + 737 (0x1081ac321 in Python)
frame #31: _PyEval_EvalFrameDefault + 6922 (0x1081a532a in Python)
frame #32: function_code_fastcall + 106 (0x108117194 in Python)
frame #33: call_function + 737 (0x1081ac321 in Python)
frame #34: _PyEval_EvalFrameDefault + 6742 (0x1081a5276 in Python)
frame #35: _PyEval_EvalCodeWithName + 1698 (0x1081acb15 in Python)
frame #36: _PyFunction_FastCallDict + 444 (0x108116a00 in Python)
frame #37: _PyObject_Call_Prepend + 131 (0x108117b07 in Python)
frame #38: PyObject_Call + 136 (0x108116ecd in Python)
frame #39: _PyEval_EvalFrameDefault + 7507 (0x1081a5573 in Python)
frame #40: _PyEval_EvalCodeWithName + 1698 (0x1081acb15 in Python)
frame #41: _PyFunction_FastCallKeywords + 212 (0x108116d88 in Python)
frame #42: call_function + 737 (0x1081ac321 in Python)
frame #43: _PyEval_EvalFrameDefault + 7090 (0x1081a53d2 in Python)
frame #44: gen_send_ex + 244 (0x1081227e7 in Python)
frame #45: builtin_next + 99 (0x1081a1cfe in Python)
frame #46: _PyMethodDef_RawFastCallKeywords + 488 (0x108117834 in Python)
frame #47: _PyCFunction_FastCallKeywords + 41 (0x108116dc0 in Python)
frame #48: call_function + 628 (0x1081ac2b4 in Python)
frame #49: _PyEval_EvalFrameDefault + 6922 (0x1081a532a in Python)
frame #50: _PyEval_EvalCodeWithName + 1698 (0x1081acb15 in Python)
frame #51: _PyFunction_FastCallKeywords + 212 (0x108116d88 in Python)
frame #52: call_function + 737 (0x1081ac321 in Python)
frame #53: _PyEval_EvalFrameDefault + 6742 (0x1081a5276 in Python)
frame #54: gen_send_ex + 244 (0x1081227e7 in Python)
frame #55: builtin_next + 99 (0x1081a1cfe in Python)
frame #56: _PyMethodDef_RawFastCallKeywords + 488 (0x108117834 in Python)
frame #57: _PyCFunction_FastCallKeywords + 41 (0x108116dc0 in Python)
frame #58: call_function + 628 (0x1081ac2b4 in Python)
frame #59: _PyEval_EvalFrameDefault + 6922 (0x1081a532a in Python)
frame #60: _PyEval_EvalCodeWithName + 1698 (0x1081acb15 in Python)
frame #61: _PyFunction_FastCallKeywords + 212 (0x108116d88 in Python)
frame #62: call_function + 737 (0x1081ac321 in Python)
frame #63: _PyEval_EvalFrameDefault + 6922 (0x1081a532a in Python)

Instructions To Reproduce the Issue:

  1. Clone & build the latest master (v 0.1)
  2. Run the deform_source_mesh_to_target_mesh.ipynb notebook on the CPU as opposed to CUDA. Make sure to have the example target 3D model downloaded and placed in the appropriate directory as instructed in cell 3.
@nikhilaravi
Copy link
Contributor

@semihcanturk thanks for raising this issue! We are currently working on more complete CPU support for all CUDA operators (face_areas_normals only has a CUDA implementation). In the meantime can you try running this on a GPU with Colab?

@nikhilaravi
Copy link
Contributor

nikhilaravi commented Feb 20, 2020

@semihcanturk this has now been fixed on master - I tested this tutorial on cpu on colab and it runs without errors (although note that the optimization will run more slowly).

q10 added a commit to q10/pytorch3d-1 that referenced this issue May 17, 2023
Summary:
X-link: fairinternal/pytorch3d#44

X-link: pytorch/pytorch#101623

- Break up D45769819 to fix fix header inclusions in c10, pt. 1

Differential Revision: D45920611

fbshipit-source-id: 6e3ed38c094e721ae24deebd13739833be447897
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants