mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-03 06:18:44 +08:00
fix device typing issue
This commit is contained in:
1 parent
7534956d69
commit
9849f64083
1 file changed
+1
-1
@@ -98,7 +98,7 @@ def nerfstudio_collate(batch: Any, extra_mappings: Union[Dict[type, Callable], N
|
|||||||
# If we're in a background process, concatenate directly into a
|
# If we're in a background process, concatenate directly into a
|
||||||
# shared memory tensor to avoid an extra copy
|
# shared memory tensor to avoid an extra copy
|
||||||
numel = sum(x.numel() for x in batch)
|
numel = sum(x.numel() for x in batch)
|
||||||
storage = elem.untyped_storage()._new_shared(numel, device=elem.device)
|
storage = elem.untyped_storage()._new_shared(numel, device=str(elem.device))
|
||||||
out = elem.new(storage).resize_(len(batch), *list(elem.size()))
|
out = elem.new(storage).resize_(len(batch), *list(elem.size()))
|
||||||
return torch.stack(batch, 0, out=out)
|
return torch.stack(batch, 0, out=out)
|
||||||
elif elem_type.__module__ == "numpy" and elem_type.__name__ not in ("str_", "string_"):
|
elif elem_type.__module__ == "numpy" and elem_type.__name__ not in ("str_", "string_"):
|
||||||
|
|||||||
Reference in new issue
Block a user