def cast_conditionally(data: mx.sym.Symbol, dtype: str) -> mx.sym.Symbol:
    """
    Workaround until no-op cast will be fixed in MXNet codebase.
    Creates cast symbol only if dtype is different from default one, i.e. float32.

    :param data: Input symbol.
    :param dtype: Target dtype.
    :return: Cast symbol or just data symbol.
    """
    if dtype != C.DTYPE_FP32:
        return mx.sym.cast(data=data, dtype=dtype)
    return data
def cast_conditionally ( data : mx . sym . Symbol , dtype : str ) -> mx . sym . Symbol : if dtype != C . DTYPE_FP32 : return mx . sym . cast ( data = data , dtype = dtype ) return data
Workaround until no-op cast will be fixed in MXNet codebase.
    Creates cast symbol only if dtype is different from default one, i.e. float32.

    :param data: Input symbol.
    :param dtype: Target dtype.
    :return: Cast symbol or just data symbol.