MCPcopy Create free account
hub / github.com/TorchSSL/TorchSSL / get_onehot

Function get_onehot

datasets/data_utils.py:147–150  ·  view source on GitHub ↗
(num_classes, idx)

Source from the content-addressed store, hash-verified

145
146
147def get_onehot(num_classes, idx):
148 onehot = np.zeros([num_classes], dtype=np.float32)
149 onehot[idx] += 1.0
150 return onehot

Callers 1

__getitem__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected