Reshape - Reshape - 2026.1 English - UG1864

Vitis Functional Simulation User Guide (UG1864)

Document_ID
UG1864
Release_Date
2026-06-23
Version
2026.1 English

a.reshape(...) and np.reshape(a, ...) both return a new varray with the requested shape and leave a unchanged. A single -1 infers the missing dimension from the total size.

a = va.array(np.arange(12), dtype=va.int32)

b = a.reshape(3, 4)          # new varray; a.shape is still (12,)
a.shape                      # (12,)
b.shape                      # (3, 4)

c = a.reshape(-1, 3)         # infer missing dimension -> (4, 3)
d = np.reshape(a, (2, 6))    # equivalent to a.reshape(2, 6)

To overwrite the original, reassign: a = a.reshape(3, 4).