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

Error for tensor shape incompatibilities.

This error provides detailed information about shape mismatches including
the operation that failed, the shapes involved, and actionable suggestions.

## Examples

    iex> error = %SnakeBridge.Error.ShapeMismatchError{
    ...>   operation: :matmul,
    ...>   shape_a: [3, 4],
    ...>   shape_b: [2, 5],
    ...>   message: "Cannot multiply matrices with incompatible shapes",
    ...>   suggestion: "A has 4 columns but B has 2 rows. Transpose B."
    ...> }
    iex> Exception.message(error)
    "Shape mismatch in matmul..."

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

```elixir
@type t() :: %SnakeBridge.Error.ShapeMismatchError{
  __exception__: true,
  expected: String.t() | nil,
  got: String.t() | nil,
  message: String.t(),
  operation: atom(),
  python_traceback: String.t() | nil,
  shape_a: [non_neg_integer()] | nil,
  shape_b: [non_neg_integer()] | nil,
  suggestion: String.t()
}
```

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

```elixir
@spec generate_suggestion(
  atom(),
  [non_neg_integer()] | nil,
  [non_neg_integer()] | nil
) :: String.t()
```

Generates a suggestion based on the operation and shapes.

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

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

Creates a ShapeMismatchError error from context.

---

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