Skip to content

Commit

Permalink
Update botorch/optim/utils/numpy_utils.py
Browse files Browse the repository at this point in the history
  • Loading branch information
saitcakmak authored Nov 6, 2024
1 parent f6f11f9 commit 3557da3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion botorch/optim/utils/numpy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ def set_tensors_from_ndarray_1d(
try:
size = tnsr.numel()
vals = array[index : index + size] if tnsr.ndim else array[index]
tnsr.copy_(torch.from_numpy(vals.reshape(tnsr.shape)).to(tnsr))
torch.as_tensor(vals, device=tnsr.device, dtype=tnsr.dtype).view(
tnsr.shape
)
index += size
except Exception as e:
raise RuntimeError(
Expand Down

0 comments on commit 3557da3

Please sign in to comment.