# `SnakeBridge.Error.DtypeMismatchError`
[🔗](https://github.com/nshkrdotcom/snakebridge/blob/v0.14.0/lib/snakebridge/error/dtype_mismatch_error.ex#L1)

Error for tensor dtype incompatibilities.

Provides information about expected vs actual dtypes and
suggestions for converting between types.

## Examples

    iex> error = %SnakeBridge.Error.DtypeMismatchError{
    ...>   expected: :float32,
    ...>   got: :float64,
    ...>   operation: :matmul,
    ...>   message: "Expected float32 but got float64"
    ...> }
    iex> Exception.message(error)
    "Dtype mismatch in matmul..."

# `dtype`
[🔗](https://github.com/nshkrdotcom/snakebridge/blob/v0.14.0/lib/snakebridge/error/dtype_mismatch_error.ex#L21)

```elixir
@type dtype() :: :float16 | :float32 | :float64 | :int32 | :int64 | :bool | atom()
```

# `t`
[🔗](https://github.com/nshkrdotcom/snakebridge/blob/v0.14.0/lib/snakebridge/error/dtype_mismatch_error.ex#L23)

```elixir
@type t() :: %SnakeBridge.Error.DtypeMismatchError{
  __exception__: true,
  expected: dtype(),
  got: dtype(),
  message: String.t(),
  operation: atom() | nil,
  python_traceback: String.t() | nil,
  suggestion: String.t()
}
```

# `generate_suggestion`
[🔗](https://github.com/nshkrdotcom/snakebridge/blob/v0.14.0/lib/snakebridge/error/dtype_mismatch_error.ex#L81)

```elixir
@spec generate_suggestion(dtype(), dtype()) :: String.t()
```

Generates a suggestion for converting between dtypes.

# `new`
[🔗](https://github.com/nshkrdotcom/snakebridge/blob/v0.14.0/lib/snakebridge/error/dtype_mismatch_error.ex#L62)

```elixir
@spec new(dtype(), dtype(), keyword()) :: t()
```

Creates a DtypeMismatchError error with conversion suggestion.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
