Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Introduce a `isa_wrapped_array` function

未关闭
#460 8 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
julia
领域
data

调研方向

从 PR 369 的 issue 评论中的详细信息开始,尤其关注提议的 isa_wrapped_array 行为和 LinearAlgebra.diag overlay 示例。确定下游数组类型所需的接口,以及它如何支持自定义解释器用例。当引入的函数行为符合该规范,并且相关用法得到覆盖时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

Most details are in https://github.com/EnzymeAD/Reactant.jl/pull/369#issuecomment-2541402690. I will copy over the important parts.

We introduce a function isa_wrapped_array that downstream packages can use to mark that their array type wraps another array. Using a union type from Adapt doesn't solve this problem, because that fundamentally doesn't extend to new array types.

With this function, we can override functions inside our custom interpreter. Consider this simple example of extending LinearAlgebra.diag

Base.Experimental.@overlay REACTANT_METHOD_TABLE function LinearAlgebra.diag(
    x::AbstractArray{T,2}, k::Integer=0
) where {T}
    if isa_wrapped_array(x) && ancestor(x) isa TracedRArray
        y = materialize_traced_array(x) # convert it to a known type
        return diag(y, k)
    else
        # invoke diag(x) on NativeInterpreter
    end
end
主要语言
Julia
星标
140
派生
45
平均合并
1 分钟
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

JuliaArrays/ArrayInterface.jl 的其他 Issue

查看 JuliaArrays/ArrayInterface.jl 的全部 Issue

相似的 Issue

更多 Julia Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。