trunk/33b24bf2185ee276aadeb1a6e90ad6a9d07b6ca5: Check num_heads in F::multi_head_attention_forward (#195381)
- PyTorch: 695 events in the last 90 days
- PyTorch: 686th Release in the last 90 days
- Previous: earlier the same day · trunk/e327243b87ad143e228439048354f28116433020: Use `istype` in `unpack_iterable` / `lazily_unpack` (#193672)
What happened
Fixes #106700 . torch::nn::functional::multi_head_attention_forward divides before it validates: const auto head_dim = embed_dim / num_heads; TORCH_CHECK (head_dim * num_heads == embed_dim, " embed_dim must be divisible by num_heads " ); so num_heads == 0 is an integer division by zero. That is not a catchable exception — the process dies. Running the call in a subprocess on Windows exits with 0xC0000094 ( STATUS_IN…
Summary assembled by rule from the sources below