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

Function OneHot

lib/data_utils.py:36–42  ·  view source on GitHub ↗
(X, n=None, negative_class=0.)

Source from the content-addressed store, hash-verified

34 return skutils.shuffle(*arrays, random_state=np_rng)
35
36def OneHot(X, n=None, negative_class=0.):
37 X = np.asarray(X).flatten()
38 if n is None:
39 n = np.max(X) + 1
40 Xoh = np.ones((len(X), n)) * negative_class
41 Xoh[np.arange(len(X)), X] = 1.
42 return Xoh
43
44def iter_data(*data, **kwargs):
45 size = kwargs.get('size', 128)

Callers 2

gen_samplesFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected