viable/strict/1790062257: Fix `torch.asarray` for buffer-protocol objects with no dtype (#188784)
- PyTorch 近 90 天出现 1329 次
- PyTorch 近 90 天第 1314 次发版
- 上一次:同一天稍早 · trunk/8224fee74a25d6b29b220560fe89bfe94d031d97: flex_gemm: accept 1-D captured tensors (#196183)
发生了什么
Fixes #188128 When no dtype is given, read the buffer's declared format (via PyBUF_FORMAT | PyBUF_STRIDES ) and map it to the matching ScalarType instead of guessing. The mapping lives in a new helper, scalar_type_from_buffer_format . It's a small, self-contained parser, but hand-rolled so the buffer path keeps working in USE_NUMPY=0 builds. It handles every PEP-3118 scalar code that has a corresponding torch dtype…
摘要按规则整理自下方来源原文