pytorch 获取模型的参数数量

    # Find total parameters and trainable parameters
    total_params = sum(p.numel() for p in model.parameters())
    print(f'{total_params:,} total parameters.')
    total_trainable_params = sum(p.numel() for p in model.parameters() if p.requires_grad)
    print(f'{total_trainable_params:,} training parameters.')

 

你可能感兴趣的:(pytorch,深度学习,pytorch,参数数量,卷积神经网络)