Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

fix convert from ss to pcs #133

Merged
merged 1 commit into from
Sep 27, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/sdk/pynni/nni/smac_tuner/convert_ss_to_scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,24 @@ def generate_pcs(nni_search_space_content):
if search_space[key]['_type'] == 'choice':
pcs_fd.write('%s categorical {%s} [%s]\n' % (
key,
str(search_space[key]['_value'])[1:-1],
search_space[key]['_value'][0]))
json.dumps(search_space[key]['_value'])[1:-1],
json.dumps(search_space[key]['_value'][0])))
elif search_space[key]['_type'] == 'randint':
# TODO: support lower bound in randint
pcs_fd.write('%s integer [0, %d] [%d]\n' % (
key,
search_space[key]['_value'][0],
search_space[key]['_value'][0]))
elif search_space[key]['_type'] == 'uniform':
pcs_fd.write('%s real %s [%f]\n' % (
pcs_fd.write('%s real %s [%s]\n' % (
key,
search_space[key]['_value'],
search_space[key]['_value'][0]))
json.dumps(search_space[key]['_value']),
json.dumps(search_space[key]['_value'][0])))
elif search_space[key]['_type'] == 'loguniform':
pcs_fd.write('%s real %s [%f] log\n' % (
pcs_fd.write('%s real %s [%s] log\n' % (
key,
search_space[key]['_value'],
search_space[key]['_value'][0]))
json.dumps(search_space[key]['_value']),
json.dumps(search_space[key]['_value'][0])))
elif search_space[key]['_type'] == 'quniform' \
and search_space[key]['_value'][2] == 1:
pcs_fd.write('%s integer [%d, %d] [%d]\n' % (
Expand Down