Moving ray bundle to float dtype

Summary: We can now move ray bundle to float dtype (e.g. from fp16 like types).

Reviewed By: bottler

Differential Revision: D57493109

fbshipit-source-id: 4e18a427e968b646fe5feafbff653811cd007981
This commit is contained in:
Roman Shapovalov 2024-05-30 10:06:38 -07:00 committed by Facebook GitHub Bot
parent bd52f4a408
commit 4ae25bfce7

View File

@ -121,6 +121,19 @@ class ImplicitronRayBundle:
else: else:
self._lengths = value self._lengths = value
def float_(self) -> None:
"""Moves the tensors to float dtype in place
(helpful for mixed-precision tensors).
"""
self.origins = self.origins.float()
self.directions = self.directions.float()
self._lengths = self._lengths.float() if self._lengths is not None else None
self.xys = self.xys.float()
self.bins = self.bins.float() if self.bins is not None else None
self.pixel_radii_2d = (
self.pixel_radii_2d.float() if self.pixel_radii_2d is not None else None
)
def is_packed(self) -> bool: def is_packed(self) -> bool:
""" """
Returns whether the ImplicitronRayBundle carries data in packed state Returns whether the ImplicitronRayBundle carries data in packed state