happens-to-be-zero zero for tangent space of primal
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- julia
- Área
- backend-api-design
Línea de trabajo
Comienza leyendo el archivo enlazado Zygote src/lib/array.jl en la zona de la línea de reduce y map, y después inspecciona rand_tangent y la funcionalidad de projection de ChainRulesCore. El issue propone una tangente cero dependiente del valor para tipos primitivos y compuestos, pero deja sin resolver la API y la selección del tipo de tangente; para darlo por terminado harían falta un diseño acordado y una implementación que cubran esos casos.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Motivation
Somtimes it would be very convenient to have access to the element of the tangent space of a particular primal which happens to be zero for type-stability reasons. i.e. 0.0 and zeros(5, 4) rather than ZeroTangent.
The example I recently encountered where this would be helpful was reduce, specifically this line in Zygote's implementation of map. It's not possible to make this bit type-stable at the minute unless you know a priori whether or not the container you're mapping over is empty, so the pullback for map(function_with_fields, (5.0, 4.0)) infers, but the pullback map(function_with_fields, [5.0, 4.0]) does not. This is because the init kwarg is generally of a different type to the elements of Δf_and_args[1].
However, if we had access to a zero whose type doesn't change when we add cotangents to it, things ought to be type-stable.
Implementation
We know that the zero always exists, because the tangent space to a primal is a vector space, so there aren't any concerns regarding existence.
It's pretty clear what the right way to do this for composite types is via recursion (think rand_tangent, but zero rather than random), so we would just need to define it for primitives. It might get a little interesting here, because there are multiple possible tangent types for a Float64 primal (Float64, Float32, Float16, Int, etc) or a Vector primal (any AbstractVector of the same length with appropriate elements types), so possibly we would need additional information (such as the target tangent type) in order to do this.
Note that we do need to know the value of the primal for the same reasons that we need to have the primals hanging around in our projection functionality.
Anyway, I thought I'd bring this up because it's not something that we've thought much about before (ZeroTangent is often a really good option). It might be easier simply avoid situations like this most of the time (e.g. in the example I mentioned, using sized containers), but it's pretty annoying that the pullback for map isn't type-stable when mapping a closure over a Vector, because people to that a lot.
- Lenguaje dominante
- Julia
- Estrellas
- 267
- Forks
- 66
- Merge medio
- 1 d 1 h
- PR fusionados (30 d)
- 9
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de JuliaDiff/ChainRulesCore.jl
-
Destructuring/iterating a `Tangent` does not unthunk fields, unlike `getindex`/`getproperty`Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 28/100
JuliaDiff/ChainRulesCore.jl#712 ·
Los mantenedores suelen responder en 1 día
-
variable scope of `@thunk`Posiblemente ocupada @chengchingwen la tomó hace 621 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 32/100
JuliaDiff/ChainRulesCore.jl#684 ·
Los mantenedores suelen responder en 1 día
-
good first issue Structural Tangent
Dificultad 2/5 1-3 horas Aptitud para principiantes 55/100
JuliaDiff/ChainRulesCore.jl#669 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
JuliaDiff/ChainRulesCore.jl#668 · 6 comentarios ·
Los mantenedores suelen responder en 1 día
-
breaking
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
JuliaDiff/ChainRulesCore.jl#665 ·
Los mantenedores suelen responder en 1 día
Todos los issues de JuliaDiff/ChainRulesCore.jl
Issues similares
-
Prescribed ice velocities never get their halos filled, so ice is created at a periodic seamAbierto🕷️ bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
CliMA/ClimaSeaIce.jl#203 ·
Los mantenedores suelen responder en 3 días
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
JuliaPhysics/BeamletOptics.jl#221 ·
Los mantenedores suelen responder en 1 día
-
release preparation spack
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
30-minutes algorithm any-language codewars dart easy elixir hackerrank hacktoberfest haskell help wanted interview-prep julia leetcode lua open-source r scala students zig
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Huerte/algo-solutions-python#163 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
QuantumSavory/QuantumClifford.jl#853 ·
Los mantenedores suelen responder en 1 día