# `EXLA.Typespec`
[🔗](https://github.com/elixir-nx/nx/blob/v0.11.0/exla/lib/exla/typespec.ex#L1)

Combined type and shape information about tensors.

In addition to the Nx types, also supports `{:pred, 8}` and `:token`,
which are used internally within the compiler.

This struct corresponds to the `xla::Shape` class in the XLA compiler,
but is also meant as a lightweight data structure for passing the
information around.

Note: the name "typespec" has been chosen intentionally to distinguish
it from both "type" and "shape".

# `tensor`

Builds a tensor typespec.

# `to_shape`

Returns an updated typespec with the given shape.

# `to_type`

Returns an updated typespec with the given type.

# `token`

Builds a token typespec.

---

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