MCPcopy Create free account
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / diagnose_network

Function diagnose_network

pix2pix/util/util.py:28–44  ·  view source on GitHub ↗

Calculate and print the mean of average absolute(gradients) Parameters: net (torch network) -- Torch network name (str) -- the name of the network

(net, name='network')

Source from the content-addressed store, hash-verified

26
27
28def diagnose_network(net, name='network'):
29 """Calculate and print the mean of average absolute(gradients)
30
31 Parameters:
32 net (torch network) -- Torch network
33 name (str) -- the name of the network
34 """
35 mean = 0.0
36 count = 0
37 for param in net.parameters():
38 if param.grad is not None:
39 mean += torch.mean(torch.abs(param.grad.data))
40 count += 1
41 if count > 0:
42 mean = mean / count
43 print(name)
44 print(mean)
45
46
47def save_image(image_numpy, image_path, aspect_ratio=1.0):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected