ryankert01 opened a new pull request, #1412:
URL: https://github.com/apache/mahout/pull/1412

   ### Related Issues
   
   Closes #1160
   
   ### Changes
   
   - [x] Bug fix
   
   ### Why
   
   In the Iris amplitude-encoding benchmark, the GPU training path
   (`_run_training_gpu`) derived its dtype straight from the QDP-encoded
   state vector:
   
   ```python
   dtype = encoded_train.dtype   # complex64 / complex128
   ```
   
   That complex dtype was then inherited by the trainable **weights**
   (consumed as `qml.Rot` rotation angles), the **bias**, and the ±1
   **labels** — all of which must be real-valued. Rotation angles and MSE
   labels in complex space are physically/mathematically wrong (and
   `torch.sign` on complex tensors is undefined).
   
   The two sibling pipelines, `mnist_amplitude.py` and `svhn_iqp.py`,
   already derive a real dtype; Iris was simply missed when that pattern
   was introduced.
   
   ### How
   
   Mirror the sibling pipelines: keep `encoded_train` complex for
   `StatePrep`, but map `complex128 -> float64` and otherwise use
   `float32` for weights, bias and labels.
   
   ```python
   real_dtype = (
       torch.float64 if encoded_train.dtype == torch.complex128 else 
torch.float32
   )
   ```
   
   ## Checklist
   
   - [ ] Added or updated unit tests for all changes
   - [ ] Added or updated documentation for all changes
   
   <sub>This is a benchmark-harness fix with no existing unit-test coverage for 
the GPU path (requires CUDA + lightning.gpu); the change matches the 
already-reviewed pattern in the sibling pipelines.</sub>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to