What is the best way to match against optional attributes?

未关闭
#1,902 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 4 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
30/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
python
领域
compilers

调研方向

该 issue 没有指出任何文件、测试或入口点。首先定位 DFT 使用的模式匹配 API,并将其与列出的四种可选属性情况进行比较;要完成此项工作,需要确定一种覆盖这些情况的方法,同时避免不必要的重复规则。

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

描述

category: question module: rewriter

Suppose we need to remove an optional input of a node, for example, we want to replace DFT(x, None, -2) with DFT(x), since the default axis is -2, so we can remove the axis input.

The DFT node has two optional attributes (onesided and inverse). What is the best way to write pattern to cover these cases:

  • DFT(x, None, -2) -> DFT(x)
  • DFT(x, None, -2, onesided=1) -> DFT(x, onesided=1)
  • DFT(x, None, -2, inverse=1) -> DFT(x, inverse=1)
  • DFT(x, None, -2, inverse=1, onesided=1) -> DFT(x, inverse=1, onesided=1)

It seems we need write four rules for the four cases, is there any better solutions? cc @justinchuby

主要语言
Python
星标
457
派生
149
平均合并
3 天 20 小时
30 天内合并 PR
22

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

microsoft/onnxscript 的其他 Issue

查看 microsoft/onnxscript 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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