pub fn sgd_state_to_map( velocity: &HashMap<u64, Tensor>, ) -> HashMap<String, Tensor>
Flatten SGD velocity buffers into a string-keyed map for serialization.
Keys: "sgd.{param_id}.velocity"
"sgd.{param_id}.velocity"