File size: 768 Bytes
bf0ce61
 
 
 
 
 
 
 
 
cbb0d9e
 
 
 
 
 
 
 
 
 
 
 
bf0ce61
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr
import torch

# Load the state dictionary from the .pth file
model_path = './checkpoints/artgan_pix2pix/latest_net_G.pth'
state_dict = torch.load(model_path, map_location=torch.device('cpu'))

# Print statistics about the weights
for name, param in state_dict.items():
    if param.dtype == torch.float32:  # Check if the parameter is of type float
        print(f"Layer: {name}")
        print(f"\tShape: {param.shape}")
        print(f"\tMean: {param.mean().item()}")
        print(f"\tStandard Deviation: {param.std().item()}")
        print(f"\tMin: {param.min().item()}")
        print(f"\tMax: {param.max().item()}")
    else:
        print(f"Layer: {name}")
        print(f"\tShape: {param.shape}")
        print(f"\tType: {param.dtype}")