MCPcopy Create free account
hub / github.com/apache/singa / normalize

Function normalize

examples/singa_peft/examples/data/cifar10.py:73–83  ·  view source on GitHub ↗
(train_x, val_x)

Source from the content-addressed store, hash-verified

71
72
73def normalize(train_x, val_x):
74 mean = [0.4914, 0.4822, 0.4465]
75 std = [0.2023, 0.1994, 0.2010]
76 train_x /= 255
77 val_x /= 255
78 for ch in range(0, 2):
79 train_x[:, ch, :, :] -= mean[ch]
80 train_x[:, ch, :, :] /= std[ch]
81 val_x[:, ch, :, :] -= mean[ch]
82 val_x[:, ch, :, :] /= std[ch]
83 return train_x, val_x
84
85def load(): # Need to pass in the path for loading training data
86 train_x, train_y = load_train_data()

Callers 1

loadFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected