Skip to content
Merged
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
File renamed without changes.
16 changes: 13 additions & 3 deletions deeptrack/optics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1124,9 +1124,17 @@ def _pad_volume(
else:
shape = shape.astype(int)

new_volume = xp.zeros(
shape.tolist(), dtype=volume.dtype, device=volume.device
)
if TORCH_AVAILABLE and isinstance(volume, torch.Tensor):
new_volume = torch.zeros(
shape.tolist(),
dtype=volume.dtype,
device=volume.device,
)
else:
new_volume = np.zeros(
shape.tolist(),
dtype=volume.dtype,
)

old_region = limits - new_limits
if TORCH_AVAILABLE and isinstance(old_region, torch.Tensor):
Expand Down Expand Up @@ -3780,4 +3788,6 @@ def _create_volume(
if device is None:
device = torch.device("cpu")
volume = torch.from_numpy(volume).to(device=device)
if limits is not None:
limits = torch.as_tensor(limits, dtype=torch.int32, device=device)
return volume, limits