Skip to content

Fix/dynamic cuda encoding method list#1100

Open
SuyashParmar wants to merge 2 commits intoapache:mainfrom
SuyashParmar:fix/dynamic-cuda-encoding-method-list
Open

Fix/dynamic cuda encoding method list#1100
SuyashParmar wants to merge 2 commits intoapache:mainfrom
SuyashParmar:fix/dynamic-cuda-encoding-method-list

Conversation

@SuyashParmar
Copy link
Contributor

What changed :
Added CUDA_ENCODING_METHODS constant in pytorch.rs
Added helper format_supported_cuda_encoding_methods() to build the error message dynamically.
Updated unknown-encoding error path to use the dynamic method list.

@SuyashParmar
Copy link
Contributor Author

@ryankert01 can you pls check the updates ?

Copy link
Contributor

@viiccwen viiccwen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, it can be resolved in #1093, also left comment.

Comment on lines +61 to +72
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])
}

Copy link
Contributor

@viiccwen viiccwen Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent of this helper function can be more clean, manual length handling and clone is unnecessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants