使用MindSpore查看模型参数

2025-04-18 14:57:37

1、可以直接加载CheckPoint统计,可能额外统计了动量和opt坡纠课柩imizer中的变量,需要过滤下相关变量。 可以参考剧安颌儿如下接口统计网络参数量。def count_params(net): """Count number of parameters in the network Args: net (mindspore.nn.Cell): Mindspore network instance Returns: total_params (int): Total number of trainable params """ total_params = 0 for param in net.trainable_params(): total_params += np.prod(param.shape) return total_params

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢