CheyuWu commented on code in PR #763:
URL: https://github.com/apache/mahout/pull/763#discussion_r2658945797


##########
qdp/qdp-python/src/lib.rs:
##########
@@ -215,6 +246,40 @@ impl QdpEngine {
         })
     }
 
+    /// Encode from PyTorch Tensor
+    ///
+    /// Args:
+    ///     tensor: PyTorch Tensor (must be on CPU)
+    ///     num_qubits: Number of qubits for encoding
+    ///     encoding_method: Encoding strategy
+    ///
+    /// Returns:
+    ///     QuantumTensor: DLPack-compatible tensor
+    fn encode_tensor(
+        &self,
+        tensor: &Bound<'_, PyAny>,
+        num_qubits: usize,
+        encoding_method: &str,
+    ) -> PyResult<QuantumTensor> {
+        validate_tensor(tensor)?;
+
+        // Convert to flat list for encoding
+        let data: Vec<f64> = tensor
+            .call_method0("flatten")?
+            .call_method0("tolist")?
+            .extract()?;

Review Comment:
   OK no problem



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