RFC: add `materialize` to materialize lazy arrays

Abierto
#839 28 comentarios 0 reacciones 1 asignado Ver en GitHub

@rgommers ya está trabajando en esto.

Desde el 20/1/2025.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

API extension Needs Discussion RFC topic: Lazy/Graph
Preface

I do not think that I am the best person to champion this effort, as I am far from the most informed person here on Lazy arrays. I'm probably missing important things, but I would like to start this discussion as I think that it is an important topic.

The problem

The problem of mixing computation requiring data-dependent properties with lazy execution is discussed in detail elsewhere:

A possible solution

Add the function materialize(x: Array) to the top level of the API. Behaviour:

Prior art
Concerns
  • I think the main concern is whether eager-only libraries will agree to adding a no-op into the API. There is precedent for that type of change (e.g. device kwargs in NumPy), but perhaps this is too obtrusive?
  • As far as I can tell there isn't a standard way to do this across lazy libraries. Does JAX just do this automatically when it would be needed? Do other libraries have this capability?
Alternatives
  1. Do nothing. The easy option, but it leaves us unable to support lazy arrays when data-dependent properties are used in computation (maybe that is okay?)
  2. An alternative API. Maybe spelled like compute* or a method on the array object. Maybe with options for partial materialization (if that's a thing)?

cc @tomnicholas @hameerabbasi @rgommers

Lenguaje dominante
Python
Estrellas
281
Forks
52
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de data-apis/array-api

Todos los issues de data-apis/array-api

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.