← 返回事件
持续讨论AI发版

viable/strict/1790062257: Fix `torch.asarray` for buffer-protocol objects with no dtype (#188784)

图:PyTorch Releases

发生了什么

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…

摘要按规则整理自下方来源原文

为什么在扩散

来源