use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct TpuInfo {
pub version: String,
pub cores: u32,
pub hbm_bytes: u64,
}
impl TpuInfo {
pub fn new(version: impl Into<String>, cores: u32, hbm_bytes: u64) -> Self {
Self { version: version.into(), cores, hbm_bytes }
}
pub fn hbm_gb(&self) -> f64 {
self.hbm_bytes as f64 / (1024.0 * 1024.0 * 1024.0)
}
}