MCPcopy Create free account
hub / github.com/tensorpack/tensorpack / sample

Function sample

examples/GAN/ConditionalGAN-mnist.py:115–129  ·  view source on GitHub ↗
(model_path)

Source from the content-addressed store, hash-verified

113
114
115def sample(model_path):
116 pred = PredictConfig(
117 session_init=SmartInit(model_path),
118 model=Model(),
119 input_names=['label', 'z'],
120 output_names=['gen/gen'])
121
122 ds = MapData(RandomZData((100, 100)),
123 lambda dp: [np.arange(100) % 10, dp[0]])
124 pred = SimpleDatasetPredictor(pred, ds)
125 for o in pred.get_result():
126 o = o[0] * 255.0
127 viz = stack_patches(o, nr_row=10, nr_col=10)
128 viz = cv2.resize(viz, (800, 800))
129 interactive_imshow(viz)
130
131
132if __name__ == '__main__':

Callers 1

Calls 9

get_resultMethod · 0.95
RandomZDataClass · 0.90
stack_patchesFunction · 0.90
interactive_imshowFunction · 0.90
PredictConfigClass · 0.85
SmartInitFunction · 0.85
MapDataClass · 0.85
ModelClass · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…