MCPcopy Create free account
hub / github.com/JunlinHan/DCLGAN / print_numpy

Function print_numpy

util/util.py:104–117  ·  view source on GitHub ↗

Print the mean, min, max, median, std, and size of a numpy array Parameters: val (bool) -- if print the values of the numpy array shp (bool) -- if print the shape of the numpy array

(x, val=True, shp=False)

Source from the content-addressed store, hash-verified

102
103
104def print_numpy(x, val=True, shp=False):
105 """Print the mean, min, max, median, std, and size of a numpy array
106
107 Parameters:
108 val (bool) -- if print the values of the numpy array
109 shp (bool) -- if print the shape of the numpy array
110 """
111 x = x.astype(np.float64)
112 if shp:
113 print('shape,', x.shape)
114 if val:
115 x = x.flatten()
116 print('mean = %3.3f, min = %3.3f, max = %3.3f, median = %3.3f, std=%3.3f' % (
117 np.mean(x), np.min(x), np.max(x), np.median(x), np.std(x)))
118
119
120def mkdirs(paths):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected