dwave.optimization.model.ArraySymbol.reshape#

ArraySymbol.reshape(*shape)#

Create a Reshape symbol.

Parameters:

shape – Shape of the created symbol.

The new symbol reshapes without changing the antecedent symbol’s data.

Examples

This example reshapes a column vector into a row vector.

>>> from dwave.optimization import Model
>>> model = Model()
>>> j = model.integer(3, lower_bound=-10, upper_bound=10)
>>> j.shape()
(3,)
>>> k = j.reshape((1, 3))
>>> k.shape()
(1, 3)