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

Function resize_dataset

examples/hfl/src/client.py:173–183  ·  view source on GitHub ↗
(x, image_size)

Source from the content-addressed store, hash-verified

171
172
173def resize_dataset(x, image_size):
174 num_data = x.shape[0]
175 dim = x.shape[1]
176 X = np.zeros(shape=(num_data, dim, image_size, image_size), dtype=np.float32)
177 for n in range(0, num_data):
178 for d in range(0, dim):
179 X[n, d, :, :] = np.array(
180 Image.fromarray(x[n, d, :, :]).resize((image_size, image_size), Image.BILINEAR),
181 dtype=np.float32,
182 )
183 return X
184
185
186def get_data(data, data_dist="iid", device_id=None):

Callers 1

runFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected