fn validate_index( index: &Option<BTreeMap<String, String>>, tensors: &[Tensor], shard: &str, ) -> Result<()>