MCPcopy Create free account
hub / github.com/Newmu/dcgan_code / Identity

Class Identity

lib/inits.py:76–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74 return sharedX(w, name=name)
75
76class Identity(object):
77
78 def __init__(self, scale=0.25):
79 self.scale = scale
80
81 def __call__(self, shape, name=None):
82 if shape[0] != shape[1]:
83 w = np.zeros(shape)
84 o_idxs = np.arange(shape[0])
85 i_idxs = np.random.permutation(np.tile(np.arange(shape[1]), shape[0]/shape[1]+1))[:shape[0]]
86 w[o_idxs, i_idxs] = self.scale
87 else:
88 w = np.identity(shape[0]) * self.scale
89 return sharedX(w, name=name)
90
91class ReluInit(object):
92

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected