'Infers the shapes of all arguments and all outputs given the known shapes of
some arguments.
This function takes the known shapes of some arguments in either positional way
or keyword argument way as input. It returns a tuple of `None` values
if there is not enough information to deduce the missing shapes.
Example usage:
>>> a = mx.sym.var(\'a\')
>>> b = mx.sym.var(\'b\')
>>> c = a + b
>>> arg_shapes, out_shapes, aux_shapes = c.infer_shape(a=(3,3))
>>> arg_shapes
[(3L, 3L), (3L, 3L)]
>>> out_shapes
[(3L, 3L)]
>>> aux_shapes
>>> c.infer_shape(a=(0,3)) # 0s in shape means unknown dimensions. So, returns None.
(None, None, None)
Inconsistencies in the known shapes will cause an error to be raised.
See the following example:
>>> data = mx.sym.Variable(\'data\')
>>> out = mx.sym.FullyConnected(data=data, name=\'fc1\', num_hidden=1000)
>>> out = mx.sym.Activation(data=out, act_type=\'relu\')
>>> out = mx.sym.FullyConnected(data=out, name=\'fc2\', num_hidden=10)
>>> weight_shape= (1, 100)
>>> data_shape = (100, 100)
>>> out.infer_shape(data=data_shape, fc1_weight=weight_shape)
Error in operator fc1: Shape inconsistent, Provided=(1,100), inferred shape=(1000,100)
Parameters
*args :
Shape of arguments in a positional way.
Unknown shape can be marked as None.
**kwargs :
Keyword arguments of the known shapes.
Returns
arg_shapes : list of tuple or None
List of argument shapes.
The order is same as the order of list_arguments().
out_shapes : list of tuple or None
List of output shapes.
The order is same as the order of list_outputs().
aux_shapes : list of tuple or None
List of auxiliary state shapes.
The order is same as the order of list_auxiliary_states().'

def infer_shape(self, *args, **kwargs):

    try:
        res = self._infer_shape_impl(False, *args, **kwargs)
        if (res[1] is None):
            (arg_shapes, _, _) = self._infer_shape_impl(True, *args, **kwargs)
            arg_names = self.list_arguments()
            unknowns = []
            for (name, shape) in zip(arg_names, arg_shapes):
                if ((not shape) or (not _numpy.prod(shape))):
                    if (len(unknowns) >= 10):
                        unknowns.append('...')
                        break
                    unknowns.append(('%s:    %s' % (name, str(shape))))
            warnings.warn(((('Cannot    decide    shape    for    the    following    arguments    ' + '(0s    in    shape    means    unknown    dimensions).    ') + 'Consider    providing    them    as    input:\n DCTB ') + '\n DCTB '.join(unknowns)), stacklevel=2)
        return res
    except MXNetError:
        print 'infer_shape    error.    Arguments:'
        for (i, arg) in enumerate(args):
            print ('        #%d:    %s' % (i, arg))
        for (k, v) in kwargs.items():
            print ('        %s:    %s' % (k, v))
        raise
