| Files | Last commit | Last update |
|---|---|---|
style(all): Remove trailing whitespace and add missing EOF newlines | 4 months ago | |
feat(operation): Add tf32 ut cases. Co-authored-by: wang-zhiyue2<wangzhiyue2@huawei.com> # message auto-generated for no-merge-commit merge: !1474 merge tf32st into master feat(operation): Add tf32 ut cases. Created-by: wang-zhiyue2 Commit-by: wang-zhiyue2 Merged-by: cann-robot Description: 添加TF32 st用例: 添加TF32中CAST_RINT和CAST_ROUND的ST用例。 See merge request: cann/pypto!1474 | 8 months ago | |
refactor(all): Remove trailing whitespace Co-authored-by: tsungl4<lidongsheng4@huawei.com> # message auto-generated for no-merge-commit merge: !2188 merge pre-commit into master refactor(all): Remove trailing whitespace Created-by: tsungl4 Commit-by: tsungl4 Merged-by: cann-robot Description: Introduce pre-commit tools, and remove trailing white space with default plugin Related Issue: #1017 See merge request: cann/pypto!2188 | 7 months ago | |
fix(operation): Add Where and Full check Co-authored-by: raoliang_sac<raoliang4@huawei.com> # message auto-generated for no-merge-commit merge: !4726 merge add_where_full_check into master fix(operation): Add Where and Full check Created-by: raoliang_sac Commit-by: raoliang_sac Merged-by: cann-robot Description: ## 修改意图 where 和 full 算子在对无符号整数(uint8/uint16/uint32/uint64)类型传入超范围负数 scalar 时缺少校验拦截,且 where 在 float scalar 与非 fp32 tensor 搭配时报错信息有误导性。本 PR 在 Python 入口层补齐校验,对齐 gcd 算子的拦截策略(binary.cpp GetIntegerScalarRange)。 ## 修改内容 **1. op/other.py — where 新增两类校验** - _check_where_dtype_consistency(input, other):通用 dtype 一致性检查。提取 input/other 的有效 dtype(pypto_impl.Tensor → .dtype,pypto_impl.Element → ._get_data_type(),float scalar → DT_FP32),两者不一致时报 where() input and other data type inconsistent。裸 int scalar 不参与检查(torch.where 允许 int 广播)。 - _check_where_scalar_unsigned:当 tensor 为无符号整数且 scalar 为负数时报 does not support negative scalar for unsigned integer tensor。 **2. op/creation.py — full 新增值域校验** - _check_full_fill_value_unsigned:当 dtype 为无符号整数且 fill_value 为负数时报 does not support negative fill_value for unsigned integer dtype。 **3. 修复既有 dead code** 原 _check_where_scalar_dtype 用 isinstance(tensor_arg, Tensor)(Python 类),但 op_wrapper._to_base 会把参数转成 pypto_impl.Tensor(base),导致检查失效。本 PR 改用 pypto_impl.Tensor,使检查在真实调用路径下生效。 ## 验证 - 新增 ut python/tests/ut/operation/test_where_full_unsigned_scalar_check.py,15/15 通过(真实 NPU 环境)。 - 改动前后对照(真实环境): | 场景 | 修复前 | 修复后 | |------|--------|--------| | where(uint8_tensor, -100) | C++ 报 uint8 不支持(未到负数检查) | negative scalar for unsigned integer tensor | | where(fp16_tensor, 1.0) | C++ ASSERT INVALID_TYPE(误导) | input and other data type inconsistent | | full(-100, uint8) | 无拦截,静默通过 | negative fill_value for unsigned integer dtype | Related Issue: #2583 See merge request: cann/pypto!4726 | 4 months ago |
| Files | Last commit | Last update |
|---|---|---|
| 4 months ago | ||
| 8 months ago | ||
| 7 months ago | ||
| 4 months ago |