Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Cannot test rule for structure where one (non-differentiable) field cannot be vectorized

Abierto
#256 7 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
julia
Área
testing-qa

Línea de trabajo

Comienza en la ruta de diferencias finitas que llama a to_vec al probar una rrule y sigue cómo se maneja un Tangent{Struct} proporcionado con x=NoTangent() y una tangente para y. Reproduce el problema con el ejemplo de Struct y verifica que probar el componente y ya no requiera vectorizar el campo x ignorado.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

I am writing an rrule for *(::Struct, arr) where the structure and function look like,

struct Struct where {T<:Real}
     x # stuff that can't be differentiated
     y::T  
end

*(s::Struct, arr) = y * x(arr)

However, I am unable to test my rrule, even with a manually provided tangent for an instance of Struct that looks like Tangent{Struct}(;x=NoTangent(), y=one(T)).

The reason seems to be that finite differences tries to to_vec the instance of struct. Given that the struct is not completely ignored, only the field x, it ends up trying to to_vec the field x as well. But this field is a reference to a rather crazy mutable structure with circular references, and so I end up with an error, and am unable to test that the rrule is correct w.r.t. y.

(To make it more concrete, the structure in question is a ScaledPlan from AbstractFFTs and the field x refers to a primitive FFT plan from FFTW, which is mutable because of its pinv cache.)

Ideally, it shouldn't matter what value is in the field x, since it is marked as NoTangent in the user-provided tangent? Just as how the entire input gets ignored if it is marked as NoTangent.

Lenguaje dominante
Julia
Estrellas
50
Forks
18
Métricas de merge de PR
Sin PR fusionados en 30 d

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

  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 JuliaDiff/ChainRulesTestUtils.jl

Todos los issues de JuliaDiff/ChainRulesTestUtils.jl

Issues similares

Más issues de Julia

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.