SuyashParmar commented on code in PR #1100:
URL: https://github.com/apache/mahout/pull/1100#discussion_r2867479937


##########
qdp/qdp-python/src/pytorch.rs:
##########
@@ -56,6 +56,20 @@ pub fn is_cuda_tensor(tensor: &Bound<'_, PyAny>) -> 
PyResult<bool> {
     Ok(device_type == "cuda")
 }
 
+const CUDA_ENCODING_METHODS: &[&str] = &["amplitude", "angle", "basis", "iqp", 
"iqp-z"];
+
+fn format_supported_cuda_encoding_methods() -> String {
+    let quoted: Vec<String> = CUDA_ENCODING_METHODS
+        .iter()
+        .map(|method| format!("'{}'", method))
+        .collect();
+    let len = quoted.len();
+    if len == 1 {
+        return quoted[0].clone();
+    }
+    format!("{}, or {}", quoted[..len - 1].join(", "), quoted[len - 1])
+}
+

Review Comment:
   @viiccwen updated this helper to a cleaner implementation (no manual length 
indexing or clone)



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