Rnntransformer
Rnntransformer
t: [[126.80995542]
The variable t is a NumPy array with a shape of (2, 1). This means it's a 2D array (two rows, one
column), where the translation values are nested within their own lists. When the code tries to
access t[0] and t[1], it's getting these single-element lists (or 1D arrays of size 1), not the scalar float
values that np.array expects for trans_params.
The Solution:
You need to extract the scalar values from the t array before using them to create trans_params. You
can do this by accessing the element at index [0, 0] and [1, 0] of the t array.
2. Locate the line: Around line 104 (where the error occurs):
Python
Python
By using t[0][0] and t[1][0], you are accessing the element at the first row and first column of the t
array, which should be the scalar translation values.
4. Remove the print() statements you added for debugging (optional, but good practice for
cleaner code).
The original code was trying to put a list (the result of t[0] and t[1]) into a NumPy array that expects
individual numbers. By using t[0][0], we are accessing the actual numerical value stored at the first
position of the first "row" of t. Similarly, t[1][0] accesses the value in the second "row". This ensures
that np.array receives individual scalar values to construct the trans_params array with the expected
shape.
This should resolve the ValueError you were encountering. Let me know if you still face any issues
after making this change!