# `Snakepit.Error.Device`
[🔗](https://github.com/nshkrdotcom/snakepit/blob/v0.13.0/lib/snakepit/error/device.ex#L61)

Device error creation helpers.

Provides functions for creating device-related errors with
telemetry emission and helpful suggestions.

# `device_mismatch`

```elixir
@spec device_mismatch(term(), term(), String.t()) :: Snakepit.Error.DeviceMismatch.t()
```

Creates a device mismatch error.

## Examples

    error = Device.device_mismatch(:cpu, {:cuda, 0}, "matmul")

# `device_unavailable`

```elixir
@spec device_unavailable(term(), String.t()) :: Snakepit.Error.DeviceMismatch.t()
```

Creates a device unavailable error.

## Examples

    error = Device.device_unavailable({:cuda, 2}, "matrix_multiply")

# `out_of_memory`

```elixir
@spec out_of_memory(term(), non_neg_integer(), non_neg_integer(), String.t() | nil) ::
  Snakepit.Error.OutOfMemory.t()
```

Creates an out of memory error with recovery suggestions.

## Examples

    error = Device.out_of_memory({:cuda, 0}, 1024 * 1024 * 1024, 512 * 1024 * 1024)

---

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