IVY_DTYPE_MAPPING = {
    "tensorflow": {
        "ivy.int8": "tf.int8",
        "ivy.int16": "tf.int16",
        "ivy.int32": "tf.int32",
        "ivy.int64": "tf.int64",
        "ivy.uint8": "tf.uint8",
        "ivy.uint16": "tf.uint16",
        "ivy.uint32": "tf.uint32",
        "ivy.uint64": "tf.uint64",
        "ivy.bfloat16": "tf.bfloat16",
        "ivy.float16": "tf.float16",
        "ivy.float32": "tf.float32",
        "ivy.float64": "tf.float64",
        "ivy.complex64": "tf.complex64",
        "ivy.complex128": "tf.complex128",
        "ivy.bool": "tf.bool",
    },
    "jax": {
        "ivy.int8": "jnp.int8",
        "ivy.int16": "jnp.int16",
        "ivy.int32": "jnp.int32",
        "ivy.int64": "jnp.int64",
        "ivy.uint8": "jnp.uint8",
        "ivy.uint16": "jnp.uint16",
        "ivy.uint32": "jnp.uint32",
        "ivy.uint64": "jnp.uint64",
        "ivy.bfloat16": "jnp.bfloat16",
        "ivy.float16": "jnp.float16",
        "ivy.float32": "jnp.float32",
        "ivy.float64": "jnp.float64",
        "ivy.complex64": "jnp.complex64",
        "ivy.complex128": "jnp.complex128",
        "ivy.bool": "jnp.bool",
    },
    "numpy": {
        "ivy.int8": "np.int8",
        "ivy.int16": "np.int16",
        "ivy.int32": "np.int32",
        "ivy.int64": "np.int64",
        "ivy.uint8": "np.uint8",
        "ivy.uint16": "np.uint16",
        "ivy.uint32": "np.uint32",
        "ivy.uint64": "np.uint64",
        "ivy.bfloat16": "np.bfloat16",
        "ivy.float16": "np.float16",
        "ivy.float32": "np.float32",
        "ivy.float64": "np.float64",
        "ivy.complex64": "np.complex64",
        "ivy.complex128": "np.complex128",
        "ivy.bool": "np.bool",
    },
    "torch": {
        "ivy.int8": "torch.int8",
        "ivy.int16": "torch.int16",
        "ivy.int32": "torch.int32",
        "ivy.int64": "torch.int64",
        "ivy.uint8": "torch.uint8",
        "ivy.uint16": "torch.uint16",
        "ivy.uint32": "torch.uint32",
        "ivy.uint64": "torch.uint64",
        "ivy.bfloat16": "torch.bfloat16",
        "ivy.float16": "torch.float16",
        "ivy.float32": "torch.float32",
        "ivy.float64": "torch.float64",
        "ivy.complex64": "torch.complex64",
        "ivy.complex128": "torch.complex128",
        "ivy.bool": "torch.bool",
    },
}

HUGGINGFACE_CLS_MAPPING = {
    "tensorflow": {
        "PreTrainedModel": (
            "TFPreTrainedModel",
            "from transformers.modeling_tf_utils import TFPreTrainedModel",
        ),
        "BaseModelOutput": (
            "TFBaseModelOutput",
            "from transformers.modeling_tf_outputs import TFBaseModelOutput",
        ),
    },
    "jax": {
        "PreTrainedModel": (
            "FlaxPreTrainedModel",
            "from transformers.modeling_flax_utils import FlaxPreTrainedModel",
        ),
        "BaseModelOutput": (
            "FlaxBaseModelOutput",
            "from transformers.modeling_flax_outputs import FlaxBaseModelOutput",
        ),
    },
    "numpy": {},
}

IVY_DEFAULT_DTYPE_MAPPING = {
    "ivy.default_dtype": {
        "tensorflow": {"true": "tf.float32", "false": "float32"},
        "torch": {"true": "torch.float32", "false": "float32"},
        "jax": {"true": "jnp.float32", "false": "float32"},
        "numpy": {"true": "np.float32", "false": "float32"},
    },
    "ivy.default_int_dtype": {
        "tensorflow": {"true": "tf.int32", "false": "int32"},
        "torch": {"true": "torch.int32", "false": "int32"},
        "jax": {"true": "jnp.int32", "false": "int32"},
        "numpy": {"true": "np.int32", "false": "int32"},
    },
    "ivy.default_uint_dtype": {
        "tensorflow": {"true": "tf.uint32", "false": "uint32"},
        "jax": {"true": "jnp.uint32", "false": "uint32"},
        "numpy": {"true": "np.uint32", "false": "uint32"},
    },
    "ivy.default_float_dtype": {
        "tensorflow": {"true": "tf.float32", "false": "float32"},
        "torch": {"true": "torch.float32", "false": "float32"},
        "jax": {"true": "jnp.float32", "false": "float32"},
        "numpy": {"true": "np.float32", "false": "float32"},
    },
    "ivy.default_complex_dtype": {
        "tensorflow": {"true": "tf.complex64", "false": "complex64"},
        "torch": {"true": "torch.complex64", "false": "complex64"},
        "jax": {"true": "jnp.complex64", "false": "complex64"},
        "numpy": {"true": "np.complex64", "false": "complex64"},
    },
}

IVY_ARR_DTYPE_DEVICE = {
    "tensorflow": {
        "ivy.Container": "dict",
        "ivy.Array": "tf.Tensor",
        "ivy.Device": "str",
        "ivy.Dtype": "str",
        "ivy.UintDtype": "str",
        "ivy.IntDtype": "str",
        "ivy.FloatDtype": "str",
        "ivy.ComplexDtype": "str",
        "ivy.Shape": "tuple",
        "ivy.NativeArray": "tf.Tensor",
        "ivy.NativeDevice": "str",
        "ivy.NativeDtype": "tf.DType",
        "ivy.NativeShape": "tf.TensorShape",
        "NativeArray": "tf.Tensor",
        "NativeDevice": "str",
        "NativeDtype": "tf.DType",
        "NativeShape": "tf.TensorShape",
        "ivy.current_backend().NativeArray": "tf.Tensor",
        "ivy.current_backend().NativeDevice": "str",
        "ivy.current_backend().NativeDtype": "tf.DType",
        "ivy.current_backend().NativeShape": "tf.TensorShape",
    },
    "torch": {
        "ivy.Container": "dict",
        "ivy.Array": "torch.Tensor",
        "ivy.Device": "str",
        "ivy.Dtype": "str",
        "ivy.UintDtype": "str",
        "ivy.IntDtype": "str",
        "ivy.FloatDtype": "str",
        "ivy.ComplexDtype": "str",
        "ivy.Shape": "tuple",
        "ivy.NativeArray": "torch.Tensor",
        "ivy.NativeDevice": "torch.device",
        "ivy.NativeDtype": "torch.dtype",
        "ivy.NativeShape": "torch.Size",
        "NativeArray": "torch.Tensor",
        "NativeDevice": "torch.device",
        "NativeDtype": "torch.dtype",
        "NativeShape": "torch.Size",
        "ivy.current_backend().NativeArray": "torch.Tensor",
        "ivy.current_backend().NativeDevice": "torch.device",
        "ivy.current_backend().NativeDtype": "torch.dtype",
        "ivy.current_backend().NativeShape": "torch.Size",
    },
    "jax": {
        "ivy.Container": "dict",
        "ivy.Array": "jax.Array",
        "ivy.Device": "str",
        "ivy.Dtype": "str",
        "ivy.UintDtype": "str",
        "ivy.IntDtype": "str",
        "ivy.FloatDtype": "str",
        "ivy.ComplexDtype": "str",
        "ivy.Shape": "tuple",
        "ivy.NativeArray": "jax.Array",
        "ivy.NativeDevice": "jax.Device",
        "ivy.NativeDtype": "np.dtype",
        "ivy.NativeShape": "tuple",
        "NativeArray": "jax.Array",
        "JaxArray": "jax.Array",
        "NativeDevice": "jax.Device",
        "NativeDtype": "np.dtype",
        "NativeShape": "tuple",
        "ivy.current_backend().NativeArray": "jax.Array",
        "ivy.current_backend().NativeDevice": "jax.Device",
        "ivy.current_backend().NativeDtype": "np.dtype",
        "ivy.current_backend().NativeShape": "tuple",
        "ivy.functional.backends.jax.JaxArray": "jax.Array",
        "ivy.functional.backends.jax.NativeArray": "jax.Array",
    },
    "numpy": {
        "ivy.Container": "dict",
        "ivy.Array": "np.ndarray",
        "ivy.Device": "str",
        "ivy.Dtype": "str",
        "ivy.UintDtype": "str",
        "ivy.IntDtype": "str",
        "ivy.FloatDtype": "str",
        "ivy.ComplexDtype": "str",
        "ivy.Shape": "tuple",
        "ivy.NativeArray": "np.ndarray",
        "ivy.NativeDevice": "str",
        "ivy.NativeDtype": "np.dtype",
        "ivy.NativeShape": "tuple",
        "NativeArray": "jax.Array",
        "NativeDevice": "jax.Device",
        "NativeDtype": "np.dtype",
        "NativeShape": "tuple",
        "ivy.current_backend().NativeArray": "np.ndarray",
        "ivy.current_backend().NativeDevice": "str",
        "ivy.current_backend().NativeDtype": "np.dtype",
        "ivy.current_backend().NativeShape": "tuple",
    },
}

NATIVE_ARR_DTYPE_DEVICE = {
    "tensorflow": {
        "tensorflow.python.framework.dtypes.DType": "tf.DType",
        "tensorflow.python.framework.tensor_shape.TensorShape": "tf.TensorShape",
        "tensorflow.python.types.core.Tensor": "tf.Tensor",
    },
    "jax": {None: None},
    "numpy": {None: None},
}

IVY_GLOBS = {
    "ivy.promotion_table": "promotion_table",
    "ivy.array_api_promotion_table": "array_api_promotion_table",
    "ivy.soft_device_mode": "False",
    "ivy.newaxis": "None",
    "ivy.valid_dtypes": [
        "int8",
        "int16",
        "int32",
        "int64",
        "uint8",
        "uint16",
        "uint32",
        "uint64",
        "bfloat16",
        "float16",
        "float32",
        "float64",
        "complex64",
        "complex128",
        "bool",
    ],
    "ivy.valid_numeric_dtypes": [
        "int8",
        "int16",
        "int32",
        "int64",
        "uint8",
        "uint16",
        "uint32",
        "uint64",
        "bfloat16",
        "float16",
        "float32",
        "float64",
        "complex64",
        "complex128",
    ],
    "ivy.valid_int_dtypes": [
        "int8",
        "int16",
        "int32",
        "int64",
        "uint8",
        "uint16",
        "uint32",
        "uint64",
    ],
    "ivy.valid_uint_dtypes": ["uint8", "uint16", "uint32", "uint64"],
    "ivy.valid_complex_dtypes": ["complex64", "complex128"],
    "ivy.valid_devices": ["cpu", "gpu"],
    "ivy.invalid_dtypes": [],
    "ivy.invalid_numeric_dtypes": [],
    "ivy.invalid_int_dtypes": [],
    "ivy.invalid_float_dtypes": [],
    "ivy.invalid_uint_dtypes": [],
    "ivy.invalid_complex_dtypes": [],
    "ivy.invalid_devices": ["tpu"],
    "ivy.backend_stack": [],
    "ivy.default_device_stack": [],
    "ivy.array_significant_figures_stack": [],
    "ivy.array_decimal_values_stack": [],
    "ivy.warning_level_stack": [],
    "ivy.queue_timeout_stack": [],
    "ivy.array_mode_stack": [],
    "ivy.inplace_mode_stack": [],
    "ivy.soft_device_mode_stack": [],
    "ivy.shape_array_mode_stack": [],
    "ivy.show_func_wrapper_trace_mode_stack": [],
    "ivy.min_denominator_stack": [],
    "ivy.min_base_stack": [],
    "ivy.tmp_dir_stack": [],
    "ivy.precise_mode_stack": [],
    "ivy.nestable_mode_stack": [],
    "ivy.exception_trace_mode_stack": [],
    "ivy.default_dtype_stack": [],
    "ivy.default_float_dtype_stack": [],
    "ivy.default_int_dtype_stack": [],
    "ivy.default_uint_dtype_stack": [],
    "ivy.nan_policy_stack": [],
    "ivy.dynamic_backend_stack": [],
}
