mxnet.symbol.Symbol.infer_type¶

Symbol.infer_type(*args, **kwargs)[source]

Infers the type of all arguments and all outputs, given the known types for some arguments.

This function takes the known types 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 types.

Inconsistencies in the known types will cause an error to be raised.

Example

>>> a = mx.sym.var('a')
>>> b = mx.sym.var('b')
>>> c = a + b
>>> arg_types, out_types, aux_types = c.infer_type(a='float32')
>>> arg_types
[<type 'numpy.float32'>, <type 'numpy.float32'>]
>>> out_types
[<type 'numpy.float32'>]
>>> aux_types
[]

Parameters: *args – Type of known arguments in a positional way. Unknown type can be marked as None. **kwargs – Keyword arguments of known types. arg_types (list of numpy.dtype or None) – List of argument types. The order is same as the order of list_arguments(). out_types (list of numpy.dtype or None) – List of output types. The order is same as the order of list_outputs(). aux_types (list of numpy.dtype or None) – List of auxiliary state types. The order is same as the order of list_auxiliary_states().