'Return a new executor with the same symbol and shared memory,
but different input/output shapes.
For runtime reshaping, variable length sequences, etc.
The returned executor shares state with the current one,
and cannot be used in parallel with it.
Parameters
partial_shaping : bool
Whether to allow changing the shape of unspecified arguments.
allow_up_sizing : bool
Whether to allow allocating new ndarrays that\'s larger than the original.
kwargs : dict of string to tuple of int
New shape for arguments.
Returns
exec : Executor
A new executor that shares memory with self.
Examples
>>> a = mx.sym.Variable(\'a\')
>>> b = mx.sym.Variable(\'b\')
>>> c = 2 * a + b
>>> texec = c.bind(mx.cpu(), {\'a\': mx.nd.zeros((2, 1)), \'b\': mx.nd.ones((2,1))})
>>> new_shape = {\'a\': (4, 2), \'b\': (4, 2)}
>>> texec.reshape(allow_up_sizing=True, **new_shape)'

def reshape(self, partial_shaping=False, allow_up_sizing=False, **kwargs):

    (arg_shapes, _, aux_shapes) = self._symbol.infer_shape(**kwargs)
    if (arg_shapes is None):
        raise ValueError('Insufficient    argument    shapes    provided.')
    new_arg_dict = {}
    new_grad_dict = {}
    for (i, name) in enumerate(self._symbol.list_arguments()):
        new_shape = arg_shapes[i]
        arr = self.arg_arrays[i]
        darr = (None if (self.grad_arrays is None) else self.grad_arrays[i])
        if (partial_shaping or (name in kwargs) or (new_shape == arr.shape)):
            if (np.prod(new_shape) > np.prod(arr.shape)):
                assert allow_up_sizing, ((((('New    shape    of    arg:%s    larger    than    original.    ' % name) + 'First    making    a    big    executor    and    then    down    sizing    it    ') + 'is    more    efficient    than    the    reverse.') + 'If    you    really    want    to    up    size,    set    allow_up_sizing=True    ') + 'to    enable    allocation    of    new    arrays.')
                new_arg_dict[name] = nd.empty(new_shape, ctx=arr.context, dtype=arr.dtype)
                if (darr is not None):
                    new_grad_dict[name] = nd.empty(new_shape, ctx=darr.context, dtype=arr.dtype)
            else:
                new_arg_dict[name] = arr.reshape(new_shape)
                if (darr is not None):
                    new_grad_dict[name] = darr.reshape(new_shape)
        else:
            raise AssertionError((((('Shape    of    unspecified    array    arg:%s    changed.    ' % name) + 'This    can    cause    the    new    executor    to    not    share    parameters    ') + 'with    the    old    one.    Please    check    for    error    in    network.') + 'If    this    is    intended,    set    partial_shaping=True    to    suppress    this    warning.'))
    new_aux_dict = {}
    for (name, new_shape, arr) in zip(self._symbol.list_auxiliary_states(), aux_shapes, self.aux_arrays):
        if (partial_shaping or (new_shape == arr.shape)):
            if (np.prod(new_shape) > np.prod(arr.shape)):
                assert allow_up_sizing, ((((('New    shape    of    arg:%s    larger    than    original.    ' % name) + 'First    making    a    big    executor    and    then    down    sizing    it    ') + 'is    more    efficient    than    the    reverse.') + 'If    you    really    want    to    up    size,    set    allow_up_sizing=True    ') + 'to    enable    allocation    of    new    arrays.')
                new_aux_dict[name] = nd.empty(new_shape, ctx=arr.context, dtype=arr.dtype)
            else:
                new_aux_dict[name] = arr.reshape(new_shape)
        else:
            raise AssertionError((((('Shape    of    unspecified    array    aux:%s    changed.    ' % name) + 'This    can    cause    the    new    executor    to    not    share    parameters    ') + 'with    the    old    one.    Please    check    for    error    in    network.') + 'If    this    is    intended,    set    partial_shaping=True    to    suppress    this    warning.'))
    return self._symbol.bind(self._ctx, args=new_arg_dict, args_grad=new_grad_dict, grad_req=self._grad_req, aux_states=new_aux_dict, group2ctx=self._group2ctx, shared_exec=self)
