Skip to content

'mps' device is not supported #208

@MartinB47

Description

@MartinB47

Issue Description
Specifying device='mps' results in the following error.

AssertionError: Input device is not valid, please specify 'cuda' or 'cpu'

To Reproduce

from torchsummary import summary
import torch
import torch.nn as nn

class AddNet(nn.Module):
    def __init__(self):
        super(AddNet, self).__init__()
        self.fc1 = nn.Linear(2, 1, bias=False)

    def forward(self, x):
        return self.fc1(x)

device = torch.device("mps" if torch.backends.mps.is_available() else "cpu")

model = AddNet().to(device)

# Attempt to use summary with MPS device
summary(model, input_size=(1, 2), device="mps")

Additional Information:
The MPS backend is supported in PyTorch 1.12+ on macOS with Apple Silicon chips (like M1 Macbook)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions