case-simplifier
- Repo stars 25
- Author repo AscendOpGenAgent
测试用例精简 Skill
你是一名测试用例精简专家。你的目标是读取 {output_dir} 中与算子对应的 .json 文件,对其中的输入 cases 进行精简,使 case 数量尽量不超过 10 个,同时保证覆盖度。
确定 .json 文件路径
当前 benchmark 结构下,测试用例存储在 .json 文件中(与 model.py 配套),并应在 Phase 1 被复制到 {output_dir}/ 目录中。按以下优先级确定要处理的 .json 文件:
- 读取
{output_dir}/model.py,分析get_input_groups()函数中引用的.json文件名(例如os.path.join(os.path.dirname(__file__), "xxx.json")),据此在{output_dir}内确定目标.json文件。由于model.py的__file__解析为model.py,get_input_groups()通常查找的是model.json,因此目标文件为{output_dir}/model.json。 - 如果
model.py中没有显式引用,则直接查找{output_dir}目录下因 Phase 1 复制而存在的.json文件(排除.json.bak)作为目标。
优先使用 {output_dir}/model.json(model.py 按 __file__ 查找同名 .json),同时保留 <op_name>.json 作为原始备份。如果找不到有效的 .json 文件,报错并停止。
关键限制
- 只允许修改确定的目标
.json文件,不要修改{output_dir}/model.py中的任何内容。 - 只允许修改或新增
{output_dir}/目录中的文件,不要改动其他目录中的文件。 - 只允许读取当前工作区目录结构内的文件与子目录;禁止读取当前工作区之外的任何路径。
前置操作
在精简前,务必将目标 .json 文件备份为同名的 .json.bak(例如 model.json.bak),以便后续全量验证时恢复。如果 <op_name>.json 是独立文件(非 model.json),也需一并备份。
精简原则
精简后的 cases 必须满足以下覆盖要求,按优先级从高到低:
- dtype 覆盖:原 cases 中出现的每种 tensor dtype(如 float16、float32、bfloat16 等)至少保留一个 case。
- attribute 可选值覆盖:对于
type: "attr"的输入,覆盖其在原 cases 中出现的不同取值类别(例如 bool 型的 True/False、正数/负数/零等边界值)。如果原始 attr 值变化很多,不要求每个值都保留,但要保留具有代表性的边界值。 - shape 维度覆盖:覆盖原 cases 中出现的不同 tensor 维度数(1维、2维、3维、4维等),每种维度至少保留一个 case。
- shape 极端值覆盖:保留极端小(如最小 shape)和极端大(如最大 shape)的 case。
- 广播模式覆盖(如适用):如果原 cases 中存在 broadcasting 场景(shape 不完全一致的 tensor 对),保留至少一个 broadcasting case。
流程
- 读取
.json文件:该文件为 JSON Lines 格式,每行是一个独立的 JSON 对象,结构通常为{"inputs": [...]}。逐行解析,提取所有 case。 - 统计分析:统计原始 cases 的 dtype 集合、attr 值集合、shape 维度集合、shape 大小范围、是否存在 broadcasting。
- 选取 case:按上述精简原则选取不超过 10 个代表性 case,尽量让每个 case 同时覆盖多个维度的差异。
- 写回
.json文件:将筛选后的 case 以 JSON Lines 格式写回原.json文件(每行一个json.dumps(...)对象,保持与原始格式一致),保持model.py不变。
- Fluxly category
- Other
- Author-declared agents
- No explicit declaration found; this is not inferred or tested compatibility
- Static check
- 88 / 100 · heuristic scan, not runtime safety proof
- Author / version / license
- @Just-it · no license declared
- Fluxly token estimate
- Lean
- Fluxly setup estimate
- Plug-and-play
- External API key
- No requirement detected
- Detected OS requirements
- Unspecified
- Runtime requirements
- Unspecified
- Detected file/system behavior
-
- Read-only
- Detected network behavior
- Local-only
- Install commands
- None (reference only)
Profile is derived at build time from SKILL.md and install vectors. Subject to drift from author intent.
Heads up: 未限定 allowed-tools,默认拥有全部工具权限。
The current SKILL.md does not define a fixed output example. 当前 benchmark 结构下,测试用例存储在 .json 文件中(与 model.py 配套),并应在 Phase 1 被复制到 {outputdir}/ 目录中。按以下优先级确定要处理的 .json 文件: 读取 {outputdir}/model.py,分析 getinputgroups() 函数中引用的 .json 文件名(例如 os.path.join(os.path.dirname(file), "xxx.json")),据此在 {outputdir} 内确定目标 .json 文件。由于…
只允许修改确定的目标 .json 文件,不要修改 {outputdir}/model.py 中的任何内容。 只允许修改或新增 {outputdir}/ 目录中的文件,不要改动其他目录中的文件。 只允许读取当前工作区目录结构内的文件与子目录;禁止读取当前工作区之外的任何路径。
在精简前,务必将目标 .json 文件备份为同名的 .json.bak(例如 model.json.bak),以便后续全量验证时恢复。如果 <opname>.json 是独立文件(非 model.json),也需一并备份。
精简后的 cases 必须满足以下覆盖要求,按优先级从高到低: dtype 覆盖:原 cases 中出现的每种 tensor dtype(如 float16、float32、bfloat16 等)至少保留一个 case。 attribute 可选值覆盖:对于 type: "attr" 的输入,覆盖其在原 cases 中出现的不同取值类别(例如 bool 型的 True/False、正数/负数/零等边界值)。如果原始 attr 值变化很多,不要求每个值都保留,但要保留具有代表性的边界值。
读取 .json 文件:该文件为 JSON Lines 格式,每行是一个独立的 JSON 对象,结构通常为 {"inputs": [...]}。逐行解析,提取所有 case。 统计分析:统计原始 cases 的 dtype 集合、attr 值集合、shape 维度集合、shape 大小范围、是否存在 broadcasting。 选取 case:按上述精简原则选取不超过 10 个代表性 case,尽量让每个 case 同时覆盖多个维度的差异。
# 测试用例精简 Skill
你是一名测试用例精简专家。你的目标是读取 `{output_dir}` 中与算子对应的 `.json` 文件,对其中的输入 cases 进行精简,使 case 数量尽量不超过 10 个,同时保证覆盖度。
## 确定 `.json` 文件路径
当前 benchmark 结构下,测试用例存储在 `.json` 文件中(与 `model.py` 配套),并应在 Phase 1 被复制到 `{output_dir}/` 目录中。按以下优先级确定要处理的 `.json` 文件:
1. 读取 `{output_dir}/model.py`,分析 `get_input_groups()` 函数中引用的 `.json` 文件名(例如 `os.path.join(os.path.dirname(__file__), "xxx.json")`),据此在 `{output_dir}` 内确定目标 `.json` 文件。由于 `model.py` 的 `__file__` 解析为 `model.py`,`get_input_groups()` 通常查找的是 `model.json`,因此目标文件为 `{output_dir}/model.json`。
2. 如果 `model.py` 中没有显式引用,则直接查找 `{output_dir}` 目录下因 Phase 1 复制而存在的 `.json` 文件(排除 `.json.bak`)作为目标。
优先使用 `{output_dir}/model.json`(`model.py` 按 `__file__` 查找同名 `.json`),同时保留 `<op_name>.json` 作为原始备份。如果找不到有效的 `.json` 文件,报错并停止。
## 关键限制
- 只允许修改确定的目标 `.json` 文件,不要修改 `{output_dir}/model.py` 中的任何内容。
- 只允许修改或新增 `{output_dir}/` 目录中的文件,不要改动其他目录中的文件。
- 只允许读取当前工作区目录结构内的文件与子目录;禁止读取当前工作区之外的任何路径。
## 前置操作
在精简前,务必将目标 `.json` 文件备份为同名的 `.json.bak`(例如 `model.json.bak`),以便后续全量验证时恢复。如果 `<op_name>.json` 是独立文件(非 `model.json`),也需一并备份。
## 精简原则
精简后的 cases 必须满足以下覆盖要求,按优先级从高到低:
1. **dtype 覆盖**:原 cases 中出现的每种 tensor dtype(如 float16、float32、bfloat16 等)至少保留一个 case。
2. **attribute 可选值覆盖**:对于 `type: "attr"` 的输入,覆盖其在原 cases 中出现的不同取值类别(例如 bool 型的 True/False、正数/负数/零等边界值)。如果原始 attr 值变化很多,不要求每个值都保留,但要保留具有代表性的边界值。
3. **shape 维度覆盖**:覆盖原 cases 中出现的不同 tensor 维度数(1维、2维、3维、4维等),每种维度至少保留一个 case。
4. **shape 极端值覆盖**:保留极端小(如最小 shape)和极端大(如最大 shape)的 case。
5. **广播模式覆盖**(如适用):如果原 cases 中存在 broadcasting 场景(shape 不完全一致的 tensor 对),保留至少一个 broadcasting case。
## 流程
1. **读取 `.json` 文件**:该文件为 **JSON Lines** 格式,每行是一个独立的 JSON 对象,结构通常为 `{"inputs": [...]}`。逐行解析,提取所有 case。
2. **统计分析**:统计原始 cases 的 dtype 集合、attr 值集合、shape 维度集合、shape 大小范围、是否存在 broadcasting。
… Author text anchors workflow facts; Fluxly only indexes current sections, terms, files, and commands.
sections -> 确定 .json 文件路径 → 关键限制 → 前置操作 → 精简原则 → 流程
terms -> dtype 覆盖 · attribute 可选值覆盖 · shape 维度覆盖 · shape 极端值覆盖 · 广播模式覆盖 · 读取 .json 文件 · JSON Lines · 统计分析
files/cmd -> {outputdir} · .json · model.py · {outputdir}/ · {outputdir}/model.py · getinputgroups() · os.path.join(os.path.dirname(file), "xxx.json") · file
body sha256 -> a3d9bb584eb5
Decide Fit First
Design Intent
How To Use It
Boundaries And Review