def get_space(): space = HyperSpace() with space.as_default(): filters = 64 in1 = Input(shape=( 28, 28, 1, )) conv = conv_cell(hp_dict, 'normal', 0, 0, 'L', [in1, in1], filters) space.set_inputs([in1, in1]) space.set_outputs(conv) return space
def func_space(func): space = HyperSpace() with space.as_default(): params = { name: copy.copy(v) for name, v in zip(func.__code__.co_varnames, func.__defaults__) if isinstance(v, ParameterSpace) } for _, v in params.items(): v.attach_to_space(space, v.name) input = HyperInput() id1 = Identity(**params)(input) space.set_outputs([id1]) return space