I got a RuntimeError expected scalar type Double but found Float when I do:
images = renderer(mesh, lights=lights, materials=materials, cameras=cameras)
My data is in torch double, the R and T for the LookAt view transformation is also torch double. I have no idea what else I could do to prevent a float input....Is this also something related to autocast?
RuntimeError Traceback (most recent call last)
----> 1 images = renderer(mesh, lights=lights, materials=materials, cameras=cameras)
~/anaconda3/envs/pytorch3d/lib/python3.8/site-packages/torch/nn/modules/module.py in _call_impl(self, input, *kwargs)
720 result = self._slow_forward(input, *kwargs)
721 else:
--> 722 result = self.forward(input, *kwargs)
723 for hook in itertools.chain(
724 _global_forward_hooks.values(),
~/anaconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/renderer/mesh/renderer.py in forward(self, meshes_world, *kwargs)
46 the range for the corresponding face.
47 """
---> 48 fragments = self.rasterizer(meshes_world, *kwargs)
49 images = self.shader(fragments, meshes_world, **kwargs)
50
~/anaconda3/envs/pytorch3d/lib/python3.8/site-packages/torch/nn/modules/module.py in _call_impl(self, input, *kwargs)
720 result = self._slow_forward(input, *kwargs)
721 else:
--> 722 result = self.forward(input, *kwargs)
723 for hook in itertools.chain(
724 _global_forward_hooks.values(),
~/anaconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/renderer/mesh/rasterizer.py in forward(self, meshes_world, *kwargs)
124 Fragments: Rasterization outputs as a named tuple.
125 """
--> 126 meshes_screen = self.transform(meshes_world, *kwargs)
127 raster_settings = kwargs.get("raster_settings", self.raster_settings)
128
~/anaconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/renderer/mesh/rasterizer.py in transform(self, meshes_world, kwargs)
106 # TODO: Revisit whether or not to transform z coordinate to [-1, 1] or
107 # [0, 1] range.
--> 108 verts_view = cameras.get_world_to_view_transform(kwargs).transform_points(
109 verts_world
110 )
~/anaconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/transforms/transform3d.py in transform_points(self, points, eps)
311
312 composed_matrix = self.get_matrix()
--> 313 points_out = _broadcast_bmm(points_batch, composed_matrix)
314 denom = points_out[..., 3:] # denominator
315 if eps is not None:
~/anaconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/transforms/transform3d.py in _broadcast_bmm(a, b)
679 if len(b) == 1:
680 b = b.expand(len(a), -1, -1)
--> 681 return a.bmm(b)
682
683
RuntimeError: expected scalar type Double but found Float
@Yumin-Sun-00 can you provide a more complete example for reproducing the error?
@Yumin-Sun-00 can you provide a more complete example for reproducing the error?
I found an exactly same problem at here
Would it be great, if you could update API documentations, if pytorch3d expect float32 as inputs?
@Yumin-Sun-00 ok glad you found a similar issue to help resolve this. Yes we can update the docs.
Hello,
Did you find the solution. I also faced this error!
Your input must be double, but float required