ryankert01 commented on code in PR #1498:
URL: https://github.com/apache/mahout/pull/1498#discussion_r4261333975


##########
qdp/qdp-python/qumat_qdp/api.py:
##########
@@ -130,8 +143,19 @@ def encoding(self, method: str) -> QdpBenchmark:
         :param method: Encoding name, for example ``"amplitude"``,
             ``"angle"``, ``"basis"``, ``"iqp"``, or ``"iqp-z"``.
         :returns: This builder for fluent chaining.
+        :raises ValueError: If ``method`` is empty, not a string, or not a
+            supported encoding.
         """
-        self._encoding_method = method
+        if not isinstance(method, str) or not method:
+            raise ValueError(
+                f"encoding_method must be a non-empty string, got {method!r}"
+            )
+        if method.lower() not in _VALID_ENCODINGS:

Review Comment:
   phase passes here, but the pytorch backend doesn’t support it.



##########
docs/qdp/python-api.md:
##########
@@ -159,17 +159,21 @@ tensor = torch.from_dlpack(qt)
 
 `QdpBenchmark(device_id=0)`
 
+- `device_id` (int): GPU device ordinal; must be a non-negative integer.
+
 **Chainable methods**
 
 | Method | Description |
 |--------|-------------|
-| `qubits(n)` | Number of qubits. |
-| `encoding(method)` | `"amplitude"` \| `"angle"` \| `"basis"` \| `"iqp"` \| 
`"iqp-z"`. |
-| `batches(total, size=64)` | Total batches and batch size. |
-| `prefetch(n)` | No-op (API compatibility). |
-| `warmup(n)` | Warmup batch count. |
+| `qubits(n)` | Number of qubits; integer in `[1, 30]`. |
+| `encoding(method)` | `"amplitude"` \| `"angle"` \| `"basis"` \| `"iqp"` \| 
`"iqp-z"` (case-insensitive). |

Review Comment:
   Validation also accepts phase



-- 
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