Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions torchsummary/torchsummary.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@
import numpy as np


def summary(model, input_size, batch_size=-1, device=torch.device('cuda:0'), dtypes=None):
def summary(model, input_size, batch_size=-1, dtypes=None):
result, params_info = summary_string(
model, input_size, batch_size, device, dtypes)
model, input_size, batch_size, dtypes)
print(result)

return params_info


def summary_string(model, input_size, batch_size=-1, device=torch.device('cuda:0'), dtypes=None):
def summary_string(model, input_size, batch_size=-1, dtypes=None):

# Take the device of the first model parameter
device = next(model.parameters()).device

if dtypes == None:
dtypes = [torch.FloatTensor]*len(input_size)

Expand Down