From 5cd9283dd02811d777cb730b1260547d57d77597 Mon Sep 17 00:00:00 2001 From: mhubii Date: Wed, 4 Feb 2026 15:28:12 +0000 Subject: [PATCH] allocate memory on batch generation (#126) --- roboreg/util/transform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roboreg/util/transform.py b/roboreg/util/transform.py index 1384fa9..4362c5c 100644 --- a/roboreg/util/transform.py +++ b/roboreg/util/transform.py @@ -64,7 +64,7 @@ def generate_ht_optical( ) -> torch.Tensor: ht_optical = torch.zeros(4, 4, dtype=dtype, device=device) if batch_size is not None: - ht_optical = ht_optical.unsqueeze(0).expand(batch_size, -1, -1) + ht_optical = ht_optical.unsqueeze(0).repeat(batch_size, 1, 1) ht_optical[..., 0, 2] = ( 1.0 # OpenCV-oriented optical frame, in quaternions: [0.5, -0.5, 0.5, -0.5] (w, x, y, z) )