partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | lognormal | mu: float or array_like of floats
sigma: float or array_like of floats
random_state: an object of numpy.random.RandomState | src/sdk/pynni/nni/parameter_expressions.py | def lognormal(mu, sigma, random_state):
'''
mu: float or array_like of floats
sigma: float or array_like of floats
random_state: an object of numpy.random.RandomState
'''
return np.exp(normal(mu, sigma, random_state)) | def lognormal(mu, sigma, random_state):
'''
mu: float or array_like of floats
sigma: float or array_like of floats
random_state: an object of numpy.random.RandomState
'''
return np.exp(normal(mu, sigma, random_state)) | [
"mu",
":",
"float",
"or",
"array_like",
"of",
"floats",
"sigma",
":",
"float",
"or",
"array_like",
"of",
"floats",
"random_state",
":",
"an",
"object",
"of",
"numpy",
".",
"random",
".",
"RandomState"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/parameter_expressions.py#L106-L112 | [
"def",
"lognormal",
"(",
"mu",
",",
"sigma",
",",
"random_state",
")",
":",
"return",
"np",
".",
"exp",
"(",
"normal",
"(",
"mu",
",",
"sigma",
",",
"random_state",
")",
")"
] | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | qlognormal | mu: float or array_like of floats
sigma: float or array_like of floats
q: sample step
random_state: an object of numpy.random.RandomState | src/sdk/pynni/nni/parameter_expressions.py | def qlognormal(mu, sigma, q, random_state):
'''
mu: float or array_like of floats
sigma: float or array_like of floats
q: sample step
random_state: an object of numpy.random.RandomState
'''
return np.round(lognormal(mu, sigma, random_state) / q) * q | def qlognormal(mu, sigma, q, random_state):
'''
mu: float or array_like of floats
sigma: float or array_like of floats
q: sample step
random_state: an object of numpy.random.RandomState
'''
return np.round(lognormal(mu, sigma, random_state) / q) * q | [
"mu",
":",
"float",
"or",
"array_like",
"of",
"floats",
"sigma",
":",
"float",
"or",
"array_like",
"of",
"floats",
"q",
":",
"sample",
"step",
"random_state",
":",
"an",
"object",
"of",
"numpy",
".",
"random",
".",
"RandomState"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/parameter_expressions.py#L115-L122 | [
"def",
"qlognormal",
"(",
"mu",
",",
"sigma",
",",
"q",
",",
"random_state",
")",
":",
"return",
"np",
".",
"round",
"(",
"lognormal",
"(",
"mu",
",",
"sigma",
",",
"random_state",
")",
"/",
"q",
")",
"*",
"q"
] | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | predict | Predict by Gaussian Process Model | src/sdk/pynni/nni/metis_tuner/Regression_GP/Prediction.py | def predict(parameters_value, regressor_gp):
'''
Predict by Gaussian Process Model
'''
parameters_value = numpy.array(parameters_value).reshape(-1, len(parameters_value))
mu, sigma = regressor_gp.predict(parameters_value, return_std=True)
return mu[0], sigma[0] | def predict(parameters_value, regressor_gp):
'''
Predict by Gaussian Process Model
'''
parameters_value = numpy.array(parameters_value).reshape(-1, len(parameters_value))
mu, sigma = regressor_gp.predict(parameters_value, return_std=True)
return mu[0], sigma[0] | [
"Predict",
"by",
"Gaussian",
"Process",
"Model"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/metis_tuner/Regression_GP/Prediction.py#L29-L36 | [
"def",
"predict",
"(",
"parameters_value",
",",
"regressor_gp",
")",
":",
"parameters_value",
"=",
"numpy",
".",
"array",
"(",
"parameters_value",
")",
".",
"reshape",
"(",
"-",
"1",
",",
"len",
"(",
"parameters_value",
")",
")",
"mu",
",",
"sigma",
"=",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | rest_get | Call rest get method | tools/nni_trial_tool/rest_utils.py | def rest_get(url, timeout):
'''Call rest get method'''
try:
response = requests.get(url, timeout=timeout)
return response
except Exception as e:
print('Get exception {0} when sending http get to url {1}'.format(str(e), url))
return None | def rest_get(url, timeout):
'''Call rest get method'''
try:
response = requests.get(url, timeout=timeout)
return response
except Exception as e:
print('Get exception {0} when sending http get to url {1}'.format(str(e), url))
return None | [
"Call",
"rest",
"get",
"method"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_trial_tool/rest_utils.py#L25-L32 | [
"def",
"rest_get",
"(",
"url",
",",
"timeout",
")",
":",
"try",
":",
"response",
"=",
"requests",
".",
"get",
"(",
"url",
",",
"timeout",
"=",
"timeout",
")",
"return",
"response",
"except",
"Exception",
"as",
"e",
":",
"print",
"(",
"'Get exception {0} ... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | rest_post | Call rest post method | tools/nni_trial_tool/rest_utils.py | def rest_post(url, data, timeout, rethrow_exception=False):
'''Call rest post method'''
try:
response = requests.post(url, headers={'Accept': 'application/json', 'Content-Type': 'application/json'},\
data=data, timeout=timeout)
return response
except Exceptio... | def rest_post(url, data, timeout, rethrow_exception=False):
'''Call rest post method'''
try:
response = requests.post(url, headers={'Accept': 'application/json', 'Content-Type': 'application/json'},\
data=data, timeout=timeout)
return response
except Exceptio... | [
"Call",
"rest",
"post",
"method"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_trial_tool/rest_utils.py#L34-L44 | [
"def",
"rest_post",
"(",
"url",
",",
"data",
",",
"timeout",
",",
"rethrow_exception",
"=",
"False",
")",
":",
"try",
":",
"response",
"=",
"requests",
".",
"post",
"(",
"url",
",",
"headers",
"=",
"{",
"'Accept'",
":",
"'application/json'",
",",
"'Conte... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | rest_put | Call rest put method | tools/nni_trial_tool/rest_utils.py | def rest_put(url, data, timeout):
'''Call rest put method'''
try:
response = requests.put(url, headers={'Accept': 'application/json', 'Content-Type': 'application/json'},\
data=data, timeout=timeout)
return response
except Exception as e:
print('Get ex... | def rest_put(url, data, timeout):
'''Call rest put method'''
try:
response = requests.put(url, headers={'Accept': 'application/json', 'Content-Type': 'application/json'},\
data=data, timeout=timeout)
return response
except Exception as e:
print('Get ex... | [
"Call",
"rest",
"put",
"method"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_trial_tool/rest_utils.py#L46-L54 | [
"def",
"rest_put",
"(",
"url",
",",
"data",
",",
"timeout",
")",
":",
"try",
":",
"response",
"=",
"requests",
".",
"put",
"(",
"url",
",",
"headers",
"=",
"{",
"'Accept'",
":",
"'application/json'",
",",
"'Content-Type'",
":",
"'application/json'",
"}",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | rest_delete | Call rest delete method | tools/nni_trial_tool/rest_utils.py | def rest_delete(url, timeout):
'''Call rest delete method'''
try:
response = requests.delete(url, timeout=timeout)
return response
except Exception as e:
print('Get exception {0} when sending http delete to url {1}'.format(str(e), url))
return None | def rest_delete(url, timeout):
'''Call rest delete method'''
try:
response = requests.delete(url, timeout=timeout)
return response
except Exception as e:
print('Get exception {0} when sending http delete to url {1}'.format(str(e), url))
return None | [
"Call",
"rest",
"delete",
"method"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_trial_tool/rest_utils.py#L56-L63 | [
"def",
"rest_delete",
"(",
"url",
",",
"timeout",
")",
":",
"try",
":",
"response",
"=",
"requests",
".",
"delete",
"(",
"url",
",",
"timeout",
"=",
"timeout",
")",
"return",
"response",
"except",
"Exception",
"as",
"e",
":",
"print",
"(",
"'Get exceptio... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | CurvefittingAssessor.trial_end | update the best performance of completed trial job
Parameters
----------
trial_job_id: int
trial job id
success: bool
True if succssfully finish the experiment, False otherwise | src/sdk/pynni/nni/curvefitting_assessor/curvefitting_assessor.py | def trial_end(self, trial_job_id, success):
"""update the best performance of completed trial job
Parameters
----------
trial_job_id: int
trial job id
success: bool
True if succssfully finish the experiment, False otherwise
"""
if ... | def trial_end(self, trial_job_id, success):
"""update the best performance of completed trial job
Parameters
----------
trial_job_id: int
trial job id
success: bool
True if succssfully finish the experiment, False otherwise
"""
if ... | [
"update",
"the",
"best",
"performance",
"of",
"completed",
"trial",
"job",
"Parameters",
"----------",
"trial_job_id",
":",
"int",
"trial",
"job",
"id",
"success",
":",
"bool",
"True",
"if",
"succssfully",
"finish",
"the",
"experiment",
"False",
"otherwise"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/curvefitting_assessor.py#L68-L86 | [
"def",
"trial_end",
"(",
"self",
",",
"trial_job_id",
",",
"success",
")",
":",
"if",
"success",
":",
"if",
"self",
".",
"set_best_performance",
":",
"self",
".",
"completed_best_performance",
"=",
"max",
"(",
"self",
".",
"completed_best_performance",
",",
"s... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | CurvefittingAssessor.assess_trial | assess whether a trial should be early stop by curve fitting algorithm
Parameters
----------
trial_job_id: int
trial job id
trial_history: list
The history performance matrix of each trial
Returns
-------
bool
AssessResult.Goo... | src/sdk/pynni/nni/curvefitting_assessor/curvefitting_assessor.py | def assess_trial(self, trial_job_id, trial_history):
"""assess whether a trial should be early stop by curve fitting algorithm
Parameters
----------
trial_job_id: int
trial job id
trial_history: list
The history performance matrix of each trial
R... | def assess_trial(self, trial_job_id, trial_history):
"""assess whether a trial should be early stop by curve fitting algorithm
Parameters
----------
trial_job_id: int
trial job id
trial_history: list
The history performance matrix of each trial
R... | [
"assess",
"whether",
"a",
"trial",
"should",
"be",
"early",
"stop",
"by",
"curve",
"fitting",
"algorithm"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/curvefitting_assessor.py#L88-L145 | [
"def",
"assess_trial",
"(",
"self",
",",
"trial_job_id",
",",
"trial_history",
")",
":",
"self",
".",
"trial_job_id",
"=",
"trial_job_id",
"self",
".",
"trial_history",
"=",
"trial_history",
"if",
"not",
"self",
".",
"set_best_performance",
":",
"return",
"Asses... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | MultiPhaseMsgDispatcher.handle_initialize | data is search space | src/sdk/pynni/nni/multi_phase/multi_phase_dispatcher.py | def handle_initialize(self, data):
'''
data is search space
'''
self.tuner.update_search_space(data)
send(CommandType.Initialized, '')
return True | def handle_initialize(self, data):
'''
data is search space
'''
self.tuner.update_search_space(data)
send(CommandType.Initialized, '')
return True | [
"data",
"is",
"search",
"space"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/multi_phase/multi_phase_dispatcher.py#L94-L100 | [
"def",
"handle_initialize",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"tuner",
".",
"update_search_space",
"(",
"data",
")",
"send",
"(",
"CommandType",
".",
"Initialized",
",",
"''",
")",
"return",
"True"
] | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | NetworkMorphismTuner.generate_parameters | Returns a set of trial neural architecture, as a serializable object.
Parameters
----------
parameter_id : int | src/sdk/pynni/nni/networkmorphism_tuner/networkmorphism_tuner.py | def generate_parameters(self, parameter_id):
"""
Returns a set of trial neural architecture, as a serializable object.
Parameters
----------
parameter_id : int
"""
if not self.history:
self.init_search()
new_father_id = None
generated... | def generate_parameters(self, parameter_id):
"""
Returns a set of trial neural architecture, as a serializable object.
Parameters
----------
parameter_id : int
"""
if not self.history:
self.init_search()
new_father_id = None
generated... | [
"Returns",
"a",
"set",
"of",
"trial",
"neural",
"architecture",
"as",
"a",
"serializable",
"object",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/networkmorphism_tuner.py#L126-L153 | [
"def",
"generate_parameters",
"(",
"self",
",",
"parameter_id",
")",
":",
"if",
"not",
"self",
".",
"history",
":",
"self",
".",
"init_search",
"(",
")",
"new_father_id",
"=",
"None",
"generated_graph",
"=",
"None",
"if",
"not",
"self",
".",
"training_queue"... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | NetworkMorphismTuner.receive_trial_result | Record an observation of the objective function.
Parameters
----------
parameter_id : int
parameters : dict
value : dict/float
if value is dict, it should have "default" key. | src/sdk/pynni/nni/networkmorphism_tuner/networkmorphism_tuner.py | def receive_trial_result(self, parameter_id, parameters, value):
""" Record an observation of the objective function.
Parameters
----------
parameter_id : int
parameters : dict
value : dict/float
if value is dict, it should have "default" key.
"""... | def receive_trial_result(self, parameter_id, parameters, value):
""" Record an observation of the objective function.
Parameters
----------
parameter_id : int
parameters : dict
value : dict/float
if value is dict, it should have "default" key.
"""... | [
"Record",
"an",
"observation",
"of",
"the",
"objective",
"function",
".",
"Parameters",
"----------",
"parameter_id",
":",
"int",
"parameters",
":",
"dict",
"value",
":",
"dict",
"/",
"float",
"if",
"value",
"is",
"dict",
"it",
"should",
"have",
"default",
"... | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/networkmorphism_tuner.py#L155-L176 | [
"def",
"receive_trial_result",
"(",
"self",
",",
"parameter_id",
",",
"parameters",
",",
"value",
")",
":",
"reward",
"=",
"extract_scalar_reward",
"(",
"value",
")",
"if",
"parameter_id",
"not",
"in",
"self",
".",
"total_data",
":",
"raise",
"RuntimeError",
"... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | NetworkMorphismTuner.init_search | Call the generators to generate the initial architectures for the search. | src/sdk/pynni/nni/networkmorphism_tuner/networkmorphism_tuner.py | def init_search(self):
"""Call the generators to generate the initial architectures for the search."""
if self.verbose:
logger.info("Initializing search.")
for generator in self.generators:
graph = generator(self.n_classes, self.input_shape).generate(
self... | def init_search(self):
"""Call the generators to generate the initial architectures for the search."""
if self.verbose:
logger.info("Initializing search.")
for generator in self.generators:
graph = generator(self.n_classes, self.input_shape).generate(
self... | [
"Call",
"the",
"generators",
"to",
"generate",
"the",
"initial",
"architectures",
"for",
"the",
"search",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/networkmorphism_tuner.py#L178-L192 | [
"def",
"init_search",
"(",
"self",
")",
":",
"if",
"self",
".",
"verbose",
":",
"logger",
".",
"info",
"(",
"\"Initializing search.\"",
")",
"for",
"generator",
"in",
"self",
".",
"generators",
":",
"graph",
"=",
"generator",
"(",
"self",
".",
"n_classes",... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | NetworkMorphismTuner.generate | Generate the next neural architecture.
Returns
-------
other_info: any object
Anything to be saved in the training queue together with the architecture.
generated_graph: Graph
An instance of Graph. | src/sdk/pynni/nni/networkmorphism_tuner/networkmorphism_tuner.py | def generate(self):
"""Generate the next neural architecture.
Returns
-------
other_info: any object
Anything to be saved in the training queue together with the architecture.
generated_graph: Graph
An instance of Graph.
"""
generated_grap... | def generate(self):
"""Generate the next neural architecture.
Returns
-------
other_info: any object
Anything to be saved in the training queue together with the architecture.
generated_graph: Graph
An instance of Graph.
"""
generated_grap... | [
"Generate",
"the",
"next",
"neural",
"architecture",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/networkmorphism_tuner.py#L194-L211 | [
"def",
"generate",
"(",
"self",
")",
":",
"generated_graph",
",",
"new_father_id",
"=",
"self",
".",
"bo",
".",
"generate",
"(",
"self",
".",
"descriptors",
")",
"if",
"new_father_id",
"is",
"None",
":",
"new_father_id",
"=",
"0",
"generated_graph",
"=",
"... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | NetworkMorphismTuner.update | Update the controller with evaluation result of a neural architecture.
Parameters
----------
other_info: any object
In our case it is the father ID in the search tree.
graph: Graph
An instance of Graph. The trained neural architecture.
metric_value: float... | src/sdk/pynni/nni/networkmorphism_tuner/networkmorphism_tuner.py | def update(self, other_info, graph, metric_value, model_id):
""" Update the controller with evaluation result of a neural architecture.
Parameters
----------
other_info: any object
In our case it is the father ID in the search tree.
graph: Graph
An instan... | def update(self, other_info, graph, metric_value, model_id):
""" Update the controller with evaluation result of a neural architecture.
Parameters
----------
other_info: any object
In our case it is the father ID in the search tree.
graph: Graph
An instan... | [
"Update",
"the",
"controller",
"with",
"evaluation",
"result",
"of",
"a",
"neural",
"architecture",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/networkmorphism_tuner.py#L213-L228 | [
"def",
"update",
"(",
"self",
",",
"other_info",
",",
"graph",
",",
"metric_value",
",",
"model_id",
")",
":",
"father_id",
"=",
"other_info",
"self",
".",
"bo",
".",
"fit",
"(",
"[",
"graph",
".",
"extract_descriptor",
"(",
")",
"]",
",",
"[",
"metric... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | NetworkMorphismTuner.add_model | Add model to the history, x_queue and y_queue
Parameters
----------
metric_value : float
graph : dict
model_id : int
Returns
-------
model : dict | src/sdk/pynni/nni/networkmorphism_tuner/networkmorphism_tuner.py | def add_model(self, metric_value, model_id):
""" Add model to the history, x_queue and y_queue
Parameters
----------
metric_value : float
graph : dict
model_id : int
Returns
-------
model : dict
"""
if self.verbose:
lo... | def add_model(self, metric_value, model_id):
""" Add model to the history, x_queue and y_queue
Parameters
----------
metric_value : float
graph : dict
model_id : int
Returns
-------
model : dict
"""
if self.verbose:
lo... | [
"Add",
"model",
"to",
"the",
"history",
"x_queue",
"and",
"y_queue"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/networkmorphism_tuner.py#L230-L253 | [
"def",
"add_model",
"(",
"self",
",",
"metric_value",
",",
"model_id",
")",
":",
"if",
"self",
".",
"verbose",
":",
"logger",
".",
"info",
"(",
"\"Saving model.\"",
")",
"# Update best_model text file",
"ret",
"=",
"{",
"\"model_id\"",
":",
"model_id",
",",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | NetworkMorphismTuner.get_best_model_id | Get the best model_id from history using the metric value | src/sdk/pynni/nni/networkmorphism_tuner/networkmorphism_tuner.py | def get_best_model_id(self):
""" Get the best model_id from history using the metric value
"""
if self.optimize_mode is OptimizeMode.Maximize:
return max(self.history, key=lambda x: x["metric_value"])["model_id"]
return min(self.history, key=lambda x: x["metric_value"])["mod... | def get_best_model_id(self):
""" Get the best model_id from history using the metric value
"""
if self.optimize_mode is OptimizeMode.Maximize:
return max(self.history, key=lambda x: x["metric_value"])["model_id"]
return min(self.history, key=lambda x: x["metric_value"])["mod... | [
"Get",
"the",
"best",
"model_id",
"from",
"history",
"using",
"the",
"metric",
"value"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/networkmorphism_tuner.py#L255-L261 | [
"def",
"get_best_model_id",
"(",
"self",
")",
":",
"if",
"self",
".",
"optimize_mode",
"is",
"OptimizeMode",
".",
"Maximize",
":",
"return",
"max",
"(",
"self",
".",
"history",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
"[",
"\"metric_value\"",
"]",
")",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | NetworkMorphismTuner.load_model_by_id | Get the model by model_id
Parameters
----------
model_id : int
model index
Returns
-------
load_model : Graph
the model graph representation | src/sdk/pynni/nni/networkmorphism_tuner/networkmorphism_tuner.py | def load_model_by_id(self, model_id):
"""Get the model by model_id
Parameters
----------
model_id : int
model index
Returns
-------
load_model : Graph
the model graph representation
"""
with open(os.path.join(self... | def load_model_by_id(self, model_id):
"""Get the model by model_id
Parameters
----------
model_id : int
model index
Returns
-------
load_model : Graph
the model graph representation
"""
with open(os.path.join(self... | [
"Get",
"the",
"model",
"by",
"model_id"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/networkmorphism_tuner.py#L263-L281 | [
"def",
"load_model_by_id",
"(",
"self",
",",
"model_id",
")",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"path",
",",
"str",
"(",
"model_id",
")",
"+",
"\".json\"",
")",
")",
"as",
"fin",
":",
"json_str",
"=",
"fin"... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | _rand_init | Random sample some init seed within bounds. | src/sdk/pynni/nni/metis_tuner/metis_tuner.py | def _rand_init(x_bounds, x_types, selection_num_starting_points):
'''
Random sample some init seed within bounds.
'''
return [lib_data.rand(x_bounds, x_types) for i \
in range(0, selection_num_starting_points)] | def _rand_init(x_bounds, x_types, selection_num_starting_points):
'''
Random sample some init seed within bounds.
'''
return [lib_data.rand(x_bounds, x_types) for i \
in range(0, selection_num_starting_points)] | [
"Random",
"sample",
"some",
"init",
"seed",
"within",
"bounds",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/metis_tuner/metis_tuner.py#L493-L498 | [
"def",
"_rand_init",
"(",
"x_bounds",
",",
"x_types",
",",
"selection_num_starting_points",
")",
":",
"return",
"[",
"lib_data",
".",
"rand",
"(",
"x_bounds",
",",
"x_types",
")",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"selection_num_starting_points",
")",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | get_median | Return median | src/sdk/pynni/nni/metis_tuner/metis_tuner.py | def get_median(temp_list):
"""Return median
"""
num = len(temp_list)
temp_list.sort()
print(temp_list)
if num % 2 == 0:
median = (temp_list[int(num/2)] + temp_list[int(num/2) - 1]) / 2
else:
median = temp_list[int(num/2)]
return median | def get_median(temp_list):
"""Return median
"""
num = len(temp_list)
temp_list.sort()
print(temp_list)
if num % 2 == 0:
median = (temp_list[int(num/2)] + temp_list[int(num/2) - 1]) / 2
else:
median = temp_list[int(num/2)]
return median | [
"Return",
"median"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/metis_tuner/metis_tuner.py#L501-L511 | [
"def",
"get_median",
"(",
"temp_list",
")",
":",
"num",
"=",
"len",
"(",
"temp_list",
")",
"temp_list",
".",
"sort",
"(",
")",
"print",
"(",
"temp_list",
")",
"if",
"num",
"%",
"2",
"==",
"0",
":",
"median",
"=",
"(",
"temp_list",
"[",
"int",
"(",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | MetisTuner.update_search_space | Update the self.x_bounds and self.x_types by the search_space.json
Parameters
----------
search_space : dict | src/sdk/pynni/nni/metis_tuner/metis_tuner.py | def update_search_space(self, search_space):
"""Update the self.x_bounds and self.x_types by the search_space.json
Parameters
----------
search_space : dict
"""
self.x_bounds = [[] for i in range(len(search_space))]
self.x_types = [NONE_TYPE for i in range(len(se... | def update_search_space(self, search_space):
"""Update the self.x_bounds and self.x_types by the search_space.json
Parameters
----------
search_space : dict
"""
self.x_bounds = [[] for i in range(len(search_space))]
self.x_types = [NONE_TYPE for i in range(len(se... | [
"Update",
"the",
"self",
".",
"x_bounds",
"and",
"self",
".",
"x_types",
"by",
"the",
"search_space",
".",
"json"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/metis_tuner/metis_tuner.py#L113-L164 | [
"def",
"update_search_space",
"(",
"self",
",",
"search_space",
")",
":",
"self",
".",
"x_bounds",
"=",
"[",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"search_space",
")",
")",
"]",
"self",
".",
"x_types",
"=",
"[",
"NONE_TYPE",
"for",
"i... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | MetisTuner._pack_output | Pack the output
Parameters
----------
init_parameter : dict
Returns
-------
output : dict | src/sdk/pynni/nni/metis_tuner/metis_tuner.py | def _pack_output(self, init_parameter):
"""Pack the output
Parameters
----------
init_parameter : dict
Returns
-------
output : dict
"""
output = {}
for i, param in enumerate(init_parameter):
output[self.key_order[i]] = param
... | def _pack_output(self, init_parameter):
"""Pack the output
Parameters
----------
init_parameter : dict
Returns
-------
output : dict
"""
output = {}
for i, param in enumerate(init_parameter):
output[self.key_order[i]] = param
... | [
"Pack",
"the",
"output"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/metis_tuner/metis_tuner.py#L167-L181 | [
"def",
"_pack_output",
"(",
"self",
",",
"init_parameter",
")",
":",
"output",
"=",
"{",
"}",
"for",
"i",
",",
"param",
"in",
"enumerate",
"(",
"init_parameter",
")",
":",
"output",
"[",
"self",
".",
"key_order",
"[",
"i",
"]",
"]",
"=",
"param",
"re... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | MetisTuner.generate_parameters | Generate next parameter for trial
If the number of trial result is lower than cold start number,
metis will first random generate some parameters.
Otherwise, metis will choose the parameters by the Gussian Process Model and the Gussian Mixture Model.
Parameters
----------
... | src/sdk/pynni/nni/metis_tuner/metis_tuner.py | def generate_parameters(self, parameter_id):
"""Generate next parameter for trial
If the number of trial result is lower than cold start number,
metis will first random generate some parameters.
Otherwise, metis will choose the parameters by the Gussian Process Model and the Gussian Mixt... | def generate_parameters(self, parameter_id):
"""Generate next parameter for trial
If the number of trial result is lower than cold start number,
metis will first random generate some parameters.
Otherwise, metis will choose the parameters by the Gussian Process Model and the Gussian Mixt... | [
"Generate",
"next",
"parameter",
"for",
"trial",
"If",
"the",
"number",
"of",
"trial",
"result",
"is",
"lower",
"than",
"cold",
"start",
"number",
"metis",
"will",
"first",
"random",
"generate",
"some",
"parameters",
".",
"Otherwise",
"metis",
"will",
"choose"... | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/metis_tuner/metis_tuner.py#L184-L212 | [
"def",
"generate_parameters",
"(",
"self",
",",
"parameter_id",
")",
":",
"if",
"len",
"(",
"self",
".",
"samples_x",
")",
"<",
"self",
".",
"cold_start_num",
":",
"init_parameter",
"=",
"_rand_init",
"(",
"self",
".",
"x_bounds",
",",
"self",
".",
"x_type... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | MetisTuner.receive_trial_result | Tuner receive result from trial.
Parameters
----------
parameter_id : int
parameters : dict
value : dict/float
if value is dict, it should have "default" key. | src/sdk/pynni/nni/metis_tuner/metis_tuner.py | def receive_trial_result(self, parameter_id, parameters, value):
"""Tuner receive result from trial.
Parameters
----------
parameter_id : int
parameters : dict
value : dict/float
if value is dict, it should have "default" key.
"""
value = extr... | def receive_trial_result(self, parameter_id, parameters, value):
"""Tuner receive result from trial.
Parameters
----------
parameter_id : int
parameters : dict
value : dict/float
if value is dict, it should have "default" key.
"""
value = extr... | [
"Tuner",
"receive",
"result",
"from",
"trial",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/metis_tuner/metis_tuner.py#L215-L255 | [
"def",
"receive_trial_result",
"(",
"self",
",",
"parameter_id",
",",
"parameters",
",",
"value",
")",
":",
"value",
"=",
"extract_scalar_reward",
"(",
"value",
")",
"if",
"self",
".",
"optimize_mode",
"==",
"OptimizeMode",
".",
"Maximize",
":",
"value",
"=",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | MetisTuner.import_data | Import additional data for tuning
Parameters
----------
data:
a list of dictionarys, each of which has at least two keys, 'parameter' and 'value' | src/sdk/pynni/nni/metis_tuner/metis_tuner.py | def import_data(self, data):
"""Import additional data for tuning
Parameters
----------
data:
a list of dictionarys, each of which has at least two keys, 'parameter' and 'value'
"""
_completed_num = 0
for trial_info in data:
logger.info("Im... | def import_data(self, data):
"""Import additional data for tuning
Parameters
----------
data:
a list of dictionarys, each of which has at least two keys, 'parameter' and 'value'
"""
_completed_num = 0
for trial_info in data:
logger.info("Im... | [
"Import",
"additional",
"data",
"for",
"tuning",
"Parameters",
"----------",
"data",
":",
"a",
"list",
"of",
"dictionarys",
"each",
"of",
"which",
"has",
"at",
"least",
"two",
"keys",
"parameter",
"and",
"value"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/metis_tuner/metis_tuner.py#L405-L427 | [
"def",
"import_data",
"(",
"self",
",",
"data",
")",
":",
"_completed_num",
"=",
"0",
"for",
"trial_info",
"in",
"data",
":",
"logger",
".",
"info",
"(",
"\"Importing data, current processing progress %s / %s\"",
"%",
"(",
"_completed_num",
",",
"len",
"(",
"dat... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | create_model | Trains GP regression model | src/sdk/pynni/nni/metis_tuner/Regression_GP/CreateModel.py | def create_model(samples_x, samples_y_aggregation,
n_restarts_optimizer=250, is_white_kernel=False):
'''
Trains GP regression model
'''
kernel = gp.kernels.ConstantKernel(constant_value=1,
constant_value_bounds=(1e-12, 1e12)) * \
... | def create_model(samples_x, samples_y_aggregation,
n_restarts_optimizer=250, is_white_kernel=False):
'''
Trains GP regression model
'''
kernel = gp.kernels.ConstantKernel(constant_value=1,
constant_value_bounds=(1e-12, 1e12)) * \
... | [
"Trains",
"GP",
"regression",
"model"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/metis_tuner/Regression_GP/CreateModel.py#L30-L52 | [
"def",
"create_model",
"(",
"samples_x",
",",
"samples_y_aggregation",
",",
"n_restarts_optimizer",
"=",
"250",
",",
"is_white_kernel",
"=",
"False",
")",
":",
"kernel",
"=",
"gp",
".",
"kernels",
".",
"ConstantKernel",
"(",
"constant_value",
"=",
"1",
",",
"c... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | GridSearchTuner.json2paramater | generate all possible configs for hyperparameters from hyperparameter space.
ss_spec: hyperparameter space | src/sdk/pynni/nni/gridsearch_tuner/gridsearch_tuner.py | def json2paramater(self, ss_spec):
'''
generate all possible configs for hyperparameters from hyperparameter space.
ss_spec: hyperparameter space
'''
if isinstance(ss_spec, dict):
if '_type' in ss_spec.keys():
_type = ss_spec['_type']
_... | def json2paramater(self, ss_spec):
'''
generate all possible configs for hyperparameters from hyperparameter space.
ss_spec: hyperparameter space
'''
if isinstance(ss_spec, dict):
if '_type' in ss_spec.keys():
_type = ss_spec['_type']
_... | [
"generate",
"all",
"possible",
"configs",
"for",
"hyperparameters",
"from",
"hyperparameter",
"space",
".",
"ss_spec",
":",
"hyperparameter",
"space"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/gridsearch_tuner/gridsearch_tuner.py#L59-L94 | [
"def",
"json2paramater",
"(",
"self",
",",
"ss_spec",
")",
":",
"if",
"isinstance",
"(",
"ss_spec",
",",
"dict",
")",
":",
"if",
"'_type'",
"in",
"ss_spec",
".",
"keys",
"(",
")",
":",
"_type",
"=",
"ss_spec",
"[",
"'_type'",
"]",
"_value",
"=",
"ss_... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | GridSearchTuner._parse_quniform | parse type of quniform parameter and return a list | src/sdk/pynni/nni/gridsearch_tuner/gridsearch_tuner.py | def _parse_quniform(self, param_value):
'''parse type of quniform parameter and return a list'''
if param_value[2] < 2:
raise RuntimeError("The number of values sampled (q) should be at least 2")
low, high, count = param_value[0], param_value[1], param_value[2]
interval = (hi... | def _parse_quniform(self, param_value):
'''parse type of quniform parameter and return a list'''
if param_value[2] < 2:
raise RuntimeError("The number of values sampled (q) should be at least 2")
low, high, count = param_value[0], param_value[1], param_value[2]
interval = (hi... | [
"parse",
"type",
"of",
"quniform",
"parameter",
"and",
"return",
"a",
"list"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/gridsearch_tuner/gridsearch_tuner.py#L96-L102 | [
"def",
"_parse_quniform",
"(",
"self",
",",
"param_value",
")",
":",
"if",
"param_value",
"[",
"2",
"]",
"<",
"2",
":",
"raise",
"RuntimeError",
"(",
"\"The number of values sampled (q) should be at least 2\"",
")",
"low",
",",
"high",
",",
"count",
"=",
"param_... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | GridSearchTuner.parse_qtype | parse type of quniform or qloguniform | src/sdk/pynni/nni/gridsearch_tuner/gridsearch_tuner.py | def parse_qtype(self, param_type, param_value):
'''parse type of quniform or qloguniform'''
if param_type == 'quniform':
return self._parse_quniform(param_value)
if param_type == 'qloguniform':
param_value[:2] = np.log(param_value[:2])
return list(np.exp(self.... | def parse_qtype(self, param_type, param_value):
'''parse type of quniform or qloguniform'''
if param_type == 'quniform':
return self._parse_quniform(param_value)
if param_type == 'qloguniform':
param_value[:2] = np.log(param_value[:2])
return list(np.exp(self.... | [
"parse",
"type",
"of",
"quniform",
"or",
"qloguniform"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/gridsearch_tuner/gridsearch_tuner.py#L104-L112 | [
"def",
"parse_qtype",
"(",
"self",
",",
"param_type",
",",
"param_value",
")",
":",
"if",
"param_type",
"==",
"'quniform'",
":",
"return",
"self",
".",
"_parse_quniform",
"(",
"param_value",
")",
"if",
"param_type",
"==",
"'qloguniform'",
":",
"param_value",
"... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | GridSearchTuner.expand_parameters | Enumerate all possible combinations of all parameters
para: {key1: [v11, v12, ...], key2: [v21, v22, ...], ...}
return: {{key1: v11, key2: v21, ...}, {key1: v11, key2: v22, ...}, ...} | src/sdk/pynni/nni/gridsearch_tuner/gridsearch_tuner.py | def expand_parameters(self, para):
'''
Enumerate all possible combinations of all parameters
para: {key1: [v11, v12, ...], key2: [v21, v22, ...], ...}
return: {{key1: v11, key2: v21, ...}, {key1: v11, key2: v22, ...}, ...}
'''
if len(para) == 1:
for key, value... | def expand_parameters(self, para):
'''
Enumerate all possible combinations of all parameters
para: {key1: [v11, v12, ...], key2: [v21, v22, ...], ...}
return: {{key1: v11, key2: v21, ...}, {key1: v11, key2: v22, ...}, ...}
'''
if len(para) == 1:
for key, value... | [
"Enumerate",
"all",
"possible",
"combinations",
"of",
"all",
"parameters",
"para",
":",
"{",
"key1",
":",
"[",
"v11",
"v12",
"...",
"]",
"key2",
":",
"[",
"v21",
"v22",
"...",
"]",
"...",
"}",
"return",
":",
"{{",
"key1",
":",
"v11",
"key2",
":",
"... | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/gridsearch_tuner/gridsearch_tuner.py#L114-L132 | [
"def",
"expand_parameters",
"(",
"self",
",",
"para",
")",
":",
"if",
"len",
"(",
"para",
")",
"==",
"1",
":",
"for",
"key",
",",
"values",
"in",
"para",
".",
"items",
"(",
")",
":",
"return",
"list",
"(",
"map",
"(",
"lambda",
"v",
":",
"{",
"... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | GridSearchTuner.import_data | Import additional data for tuning
Parameters
----------
data:
a list of dictionarys, each of which has at least two keys, 'parameter' and 'value' | src/sdk/pynni/nni/gridsearch_tuner/gridsearch_tuner.py | def import_data(self, data):
"""Import additional data for tuning
Parameters
----------
data:
a list of dictionarys, each of which has at least two keys, 'parameter' and 'value'
"""
_completed_num = 0
for trial_info in data:
logger.info("I... | def import_data(self, data):
"""Import additional data for tuning
Parameters
----------
data:
a list of dictionarys, each of which has at least two keys, 'parameter' and 'value'
"""
_completed_num = 0
for trial_info in data:
logger.info("I... | [
"Import",
"additional",
"data",
"for",
"tuning"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/gridsearch_tuner/gridsearch_tuner.py#L153-L174 | [
"def",
"import_data",
"(",
"self",
",",
"data",
")",
":",
"_completed_num",
"=",
"0",
"for",
"trial_info",
"in",
"data",
":",
"logger",
".",
"info",
"(",
"\"Importing data, current processing progress %s / %s\"",
"%",
"(",
"_completed_num",
",",
"len",
"(",
"dat... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | nni_log | Log message into stdout | tools/nni_trial_tool/log_utils.py | def nni_log(log_type, log_message):
'''Log message into stdout'''
dt = datetime.now()
print('[{0}] {1} {2}'.format(dt, log_type.value, log_message)) | def nni_log(log_type, log_message):
'''Log message into stdout'''
dt = datetime.now()
print('[{0}] {1} {2}'.format(dt, log_type.value, log_message)) | [
"Log",
"message",
"into",
"stdout"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_trial_tool/log_utils.py#L54-L57 | [
"def",
"nni_log",
"(",
"log_type",
",",
"log_message",
")",
":",
"dt",
"=",
"datetime",
".",
"now",
"(",
")",
"print",
"(",
"'[{0}] {1} {2}'",
".",
"format",
"(",
"dt",
",",
"log_type",
".",
"value",
",",
"log_message",
")",
")"
] | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | RemoteLogger.write | Write buffer data into logger/stdout | tools/nni_trial_tool/log_utils.py | def write(self, buf):
'''
Write buffer data into logger/stdout
'''
for line in buf.rstrip().splitlines():
self.orig_stdout.write(line.rstrip() + '\n')
self.orig_stdout.flush()
try:
self.logger.log(self.log_level, line.rstrip())
... | def write(self, buf):
'''
Write buffer data into logger/stdout
'''
for line in buf.rstrip().splitlines():
self.orig_stdout.write(line.rstrip() + '\n')
self.orig_stdout.flush()
try:
self.logger.log(self.log_level, line.rstrip())
... | [
"Write",
"buffer",
"data",
"into",
"logger",
"/",
"stdout"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_trial_tool/log_utils.py#L106-L116 | [
"def",
"write",
"(",
"self",
",",
"buf",
")",
":",
"for",
"line",
"in",
"buf",
".",
"rstrip",
"(",
")",
".",
"splitlines",
"(",
")",
":",
"self",
".",
"orig_stdout",
".",
"write",
"(",
"line",
".",
"rstrip",
"(",
")",
"+",
"'\\n'",
")",
"self",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | PipeLogReader.run | Run the thread, logging everything.
If the log_collection is 'none', the log content will not be enqueued | tools/nni_trial_tool/log_utils.py | def run(self):
"""Run the thread, logging everything.
If the log_collection is 'none', the log content will not be enqueued
"""
for line in iter(self.pipeReader.readline, ''):
self.orig_stdout.write(line.rstrip() + '\n')
self.orig_stdout.flush()
if ... | def run(self):
"""Run the thread, logging everything.
If the log_collection is 'none', the log content will not be enqueued
"""
for line in iter(self.pipeReader.readline, ''):
self.orig_stdout.write(line.rstrip() + '\n')
self.orig_stdout.flush()
if ... | [
"Run",
"the",
"thread",
"logging",
"everything",
".",
"If",
"the",
"log_collection",
"is",
"none",
"the",
"log",
"content",
"will",
"not",
"be",
"enqueued"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_trial_tool/log_utils.py#L168-L181 | [
"def",
"run",
"(",
"self",
")",
":",
"for",
"line",
"in",
"iter",
"(",
"self",
".",
"pipeReader",
".",
"readline",
",",
"''",
")",
":",
"self",
".",
"orig_stdout",
".",
"write",
"(",
"line",
".",
"rstrip",
"(",
")",
"+",
"'\\n'",
")",
"self",
"."... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | extract_scalar_reward | Extract scalar reward from trial result.
Raises
------
RuntimeError
Incorrect final result: the final result should be float/int,
or a dict which has a key named "default" whose value is float/int. | src/sdk/pynni/nni/utils.py | def extract_scalar_reward(value, scalar_key='default'):
"""
Extract scalar reward from trial result.
Raises
------
RuntimeError
Incorrect final result: the final result should be float/int,
or a dict which has a key named "default" whose value is float/int.
"""
if isinstance... | def extract_scalar_reward(value, scalar_key='default'):
"""
Extract scalar reward from trial result.
Raises
------
RuntimeError
Incorrect final result: the final result should be float/int,
or a dict which has a key named "default" whose value is float/int.
"""
if isinstance... | [
"Extract",
"scalar",
"reward",
"from",
"trial",
"result",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/utils.py#L25-L41 | [
"def",
"extract_scalar_reward",
"(",
"value",
",",
"scalar_key",
"=",
"'default'",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"float",
")",
"or",
"isinstance",
"(",
"value",
",",
"int",
")",
":",
"reward",
"=",
"value",
"elif",
"isinstance",
"(",
"... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | convert_dict2tuple | convert dict type to tuple to solve unhashable problem. | src/sdk/pynni/nni/utils.py | def convert_dict2tuple(value):
"""
convert dict type to tuple to solve unhashable problem.
"""
if isinstance(value, dict):
for _keys in value:
value[_keys] = convert_dict2tuple(value[_keys])
return tuple(sorted(value.items()))
else:
return value | def convert_dict2tuple(value):
"""
convert dict type to tuple to solve unhashable problem.
"""
if isinstance(value, dict):
for _keys in value:
value[_keys] = convert_dict2tuple(value[_keys])
return tuple(sorted(value.items()))
else:
return value | [
"convert",
"dict",
"type",
"to",
"tuple",
"to",
"solve",
"unhashable",
"problem",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/utils.py#L43-L52 | [
"def",
"convert_dict2tuple",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"dict",
")",
":",
"for",
"_keys",
"in",
"value",
":",
"value",
"[",
"_keys",
"]",
"=",
"convert_dict2tuple",
"(",
"value",
"[",
"_keys",
"]",
")",
"return",
"tu... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | init_dispatcher_logger | Initialize dispatcher logging configuration | src/sdk/pynni/nni/utils.py | def init_dispatcher_logger():
""" Initialize dispatcher logging configuration"""
logger_file_path = 'dispatcher.log'
if dispatcher_env_vars.NNI_LOG_DIRECTORY is not None:
logger_file_path = os.path.join(dispatcher_env_vars.NNI_LOG_DIRECTORY, logger_file_path)
init_logger(logger_file_path, dispat... | def init_dispatcher_logger():
""" Initialize dispatcher logging configuration"""
logger_file_path = 'dispatcher.log'
if dispatcher_env_vars.NNI_LOG_DIRECTORY is not None:
logger_file_path = os.path.join(dispatcher_env_vars.NNI_LOG_DIRECTORY, logger_file_path)
init_logger(logger_file_path, dispat... | [
"Initialize",
"dispatcher",
"logging",
"configuration"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/utils.py#L54-L59 | [
"def",
"init_dispatcher_logger",
"(",
")",
":",
"logger_file_path",
"=",
"'dispatcher.log'",
"if",
"dispatcher_env_vars",
".",
"NNI_LOG_DIRECTORY",
"is",
"not",
"None",
":",
"logger_file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dispatcher_env_vars",
".",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | CG_BOHB.sample_from_largest_budget | We opted for a single multidimensional KDE compared to the
hierarchy of one-dimensional KDEs used in TPE. The dimensional is
seperated by budget. This function sample a configuration from
largest budget. Firstly we sample "num_samples" configurations,
then prefer one with the largest l(x... | src/sdk/pynni/nni/bohb_advisor/config_generator.py | def sample_from_largest_budget(self, info_dict):
"""We opted for a single multidimensional KDE compared to the
hierarchy of one-dimensional KDEs used in TPE. The dimensional is
seperated by budget. This function sample a configuration from
largest budget. Firstly we sample "num_samples" ... | def sample_from_largest_budget(self, info_dict):
"""We opted for a single multidimensional KDE compared to the
hierarchy of one-dimensional KDEs used in TPE. The dimensional is
seperated by budget. This function sample a configuration from
largest budget. Firstly we sample "num_samples" ... | [
"We",
"opted",
"for",
"a",
"single",
"multidimensional",
"KDE",
"compared",
"to",
"the",
"hierarchy",
"of",
"one",
"-",
"dimensional",
"KDEs",
"used",
"in",
"TPE",
".",
"The",
"dimensional",
"is",
"seperated",
"by",
"budget",
".",
"This",
"function",
"sample... | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/bohb_advisor/config_generator.py#L114-L205 | [
"def",
"sample_from_largest_budget",
"(",
"self",
",",
"info_dict",
")",
":",
"best",
"=",
"np",
".",
"inf",
"best_vector",
"=",
"None",
"budget",
"=",
"max",
"(",
"self",
".",
"kde_models",
".",
"keys",
"(",
")",
")",
"l",
"=",
"self",
".",
"kde_model... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | CG_BOHB.get_config | Function to sample a new configuration
This function is called inside BOHB to query a new configuration
Parameters:
-----------
budget: float
the budget for which this configuration is scheduled
Returns
-------
config
return a valid confi... | src/sdk/pynni/nni/bohb_advisor/config_generator.py | def get_config(self, budget):
"""Function to sample a new configuration
This function is called inside BOHB to query a new configuration
Parameters:
-----------
budget: float
the budget for which this configuration is scheduled
Returns
-------
... | def get_config(self, budget):
"""Function to sample a new configuration
This function is called inside BOHB to query a new configuration
Parameters:
-----------
budget: float
the budget for which this configuration is scheduled
Returns
-------
... | [
"Function",
"to",
"sample",
"a",
"new",
"configuration",
"This",
"function",
"is",
"called",
"inside",
"BOHB",
"to",
"query",
"a",
"new",
"configuration"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/bohb_advisor/config_generator.py#L207-L241 | [
"def",
"get_config",
"(",
"self",
",",
"budget",
")",
":",
"logger",
".",
"debug",
"(",
"'start sampling a new configuration.'",
")",
"sample",
"=",
"None",
"info_dict",
"=",
"{",
"}",
"# If no model is available, sample from prior",
"# also mix in a fraction of random co... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | CG_BOHB.new_result | Function to register finished runs. Every time a run has finished, this function should be called
to register it with the loss.
Parameters:
-----------
loss: float
the loss of the parameters
budget: float
the budget of the parameters
parameters: d... | src/sdk/pynni/nni/bohb_advisor/config_generator.py | def new_result(self, loss, budget, parameters, update_model=True):
"""
Function to register finished runs. Every time a run has finished, this function should be called
to register it with the loss.
Parameters:
-----------
loss: float
the loss of the paramete... | def new_result(self, loss, budget, parameters, update_model=True):
"""
Function to register finished runs. Every time a run has finished, this function should be called
to register it with the loss.
Parameters:
-----------
loss: float
the loss of the paramete... | [
"Function",
"to",
"register",
"finished",
"runs",
".",
"Every",
"time",
"a",
"run",
"has",
"finished",
"this",
"function",
"should",
"be",
"called",
"to",
"register",
"it",
"with",
"the",
"loss",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/bohb_advisor/config_generator.py#L266-L349 | [
"def",
"new_result",
"(",
"self",
",",
"loss",
",",
"budget",
",",
"parameters",
",",
"update_model",
"=",
"True",
")",
":",
"if",
"loss",
"is",
"None",
":",
"# One could skip crashed results, but we decided",
"# assign a +inf loss and count them as bad configurations",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | BatchTuner.is_valid | Check the search space is valid: only contains 'choice' type
Parameters
----------
search_space : dict | src/sdk/pynni/nni/batch_tuner/batch_tuner.py | def is_valid(self, search_space):
"""
Check the search space is valid: only contains 'choice' type
Parameters
----------
search_space : dict
"""
if not len(search_space) == 1:
raise RuntimeError('BatchTuner only supprt one combined-paramreters... | def is_valid(self, search_space):
"""
Check the search space is valid: only contains 'choice' type
Parameters
----------
search_space : dict
"""
if not len(search_space) == 1:
raise RuntimeError('BatchTuner only supprt one combined-paramreters... | [
"Check",
"the",
"search",
"space",
"is",
"valid",
":",
"only",
"contains",
"choice",
"type",
"Parameters",
"----------",
"search_space",
":",
"dict"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/batch_tuner/batch_tuner.py#L54-L73 | [
"def",
"is_valid",
"(",
"self",
",",
"search_space",
")",
":",
"if",
"not",
"len",
"(",
"search_space",
")",
"==",
"1",
":",
"raise",
"RuntimeError",
"(",
"'BatchTuner only supprt one combined-paramreters key.'",
")",
"for",
"param",
"in",
"search_space",
":",
"... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | BatchTuner.generate_parameters | Returns a dict of trial (hyper-)parameters, as a serializable object.
Parameters
----------
parameter_id : int | src/sdk/pynni/nni/batch_tuner/batch_tuner.py | def generate_parameters(self, parameter_id):
"""Returns a dict of trial (hyper-)parameters, as a serializable object.
Parameters
----------
parameter_id : int
"""
self.count +=1
if self.count>len(self.values)-1:
raise nni.NoMoreTrialError('no more par... | def generate_parameters(self, parameter_id):
"""Returns a dict of trial (hyper-)parameters, as a serializable object.
Parameters
----------
parameter_id : int
"""
self.count +=1
if self.count>len(self.values)-1:
raise nni.NoMoreTrialError('no more par... | [
"Returns",
"a",
"dict",
"of",
"trial",
"(",
"hyper",
"-",
")",
"parameters",
"as",
"a",
"serializable",
"object",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/batch_tuner/batch_tuner.py#L84-L94 | [
"def",
"generate_parameters",
"(",
"self",
",",
"parameter_id",
")",
":",
"self",
".",
"count",
"+=",
"1",
"if",
"self",
".",
"count",
">",
"len",
"(",
"self",
".",
"values",
")",
"-",
"1",
":",
"raise",
"nni",
".",
"NoMoreTrialError",
"(",
"'no more p... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | normalize | Applies layer normalization.
Args:
inputs: A tensor with 2 or more dimensions, where the first dimension has
`batch_size`.
epsilon: A floating number. A very small number for preventing ZeroDivision Error.
scope: Optional scope for `variable_scope`.
reuse: Boolean, whether to reuse ... | examples/trials/weight_sharing/ga_squad/graph_to_tf.py | def normalize(inputs,
epsilon=1e-8,
scope="ln"):
'''Applies layer normalization.
Args:
inputs: A tensor with 2 or more dimensions, where the first dimension has
`batch_size`.
epsilon: A floating number. A very small number for preventing ZeroDivision Error.
... | def normalize(inputs,
epsilon=1e-8,
scope="ln"):
'''Applies layer normalization.
Args:
inputs: A tensor with 2 or more dimensions, where the first dimension has
`batch_size`.
epsilon: A floating number. A very small number for preventing ZeroDivision Error.
... | [
"Applies",
"layer",
"normalization",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/examples/trials/weight_sharing/ga_squad/graph_to_tf.py#L28-L54 | [
"def",
"normalize",
"(",
"inputs",
",",
"epsilon",
"=",
"1e-8",
",",
"scope",
"=",
"\"ln\"",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"scope",
")",
":",
"inputs_shape",
"=",
"inputs",
".",
"get_shape",
"(",
")",
"params_shape",
"=",
"inputs_sh... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | multihead_attention | Applies multihead attention.
Args:
queries: A 3d tensor with shape of [N, T_q, C_q].
keys: A 3d tensor with shape of [N, T_k, C_k].
num_units: A cdscalar. Attention size.
dropout_rate: A floating point number.
is_training: Boolean. Controller of mechanism for dropout.
causality:... | examples/trials/weight_sharing/ga_squad/graph_to_tf.py | def multihead_attention(queries,
keys,
scope="multihead_attention",
num_units=None,
num_heads=4,
dropout_rate=0,
is_training=True,
causality=False):
... | def multihead_attention(queries,
keys,
scope="multihead_attention",
num_units=None,
num_heads=4,
dropout_rate=0,
is_training=True,
causality=False):
... | [
"Applies",
"multihead",
"attention",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/examples/trials/weight_sharing/ga_squad/graph_to_tf.py#L57-L164 | [
"def",
"multihead_attention",
"(",
"queries",
",",
"keys",
",",
"scope",
"=",
"\"multihead_attention\"",
",",
"num_units",
"=",
"None",
",",
"num_heads",
"=",
"4",
",",
"dropout_rate",
"=",
"0",
",",
"is_training",
"=",
"True",
",",
"causality",
"=",
"False"... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | positional_encoding | Return positinal embedding. | examples/trials/weight_sharing/ga_squad/graph_to_tf.py | def positional_encoding(inputs,
num_units=None,
zero_pad=True,
scale=True,
scope="positional_encoding",
reuse=None):
'''
Return positinal embedding.
'''
Shape = tf.shape(inputs)
N ... | def positional_encoding(inputs,
num_units=None,
zero_pad=True,
scale=True,
scope="positional_encoding",
reuse=None):
'''
Return positinal embedding.
'''
Shape = tf.shape(inputs)
N ... | [
"Return",
"positinal",
"embedding",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/examples/trials/weight_sharing/ga_squad/graph_to_tf.py#L167-L205 | [
"def",
"positional_encoding",
"(",
"inputs",
",",
"num_units",
"=",
"None",
",",
"zero_pad",
"=",
"True",
",",
"scale",
"=",
"True",
",",
"scope",
"=",
"\"positional_encoding\"",
",",
"reuse",
"=",
"None",
")",
":",
"Shape",
"=",
"tf",
".",
"shape",
"(",... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | feedforward | Point-wise feed forward net.
Args:
inputs: A 3d tensor with shape of [N, T, C].
num_units: A list of two integers.
scope: Optional scope for `variable_scope`.
reuse: Boolean, whether to reuse the weights of a previous layer
by the same name.
Returns:
A 3d tensor with the ... | examples/trials/weight_sharing/ga_squad/graph_to_tf.py | def feedforward(inputs,
num_units,
scope="multihead_attention"):
'''Point-wise feed forward net.
Args:
inputs: A 3d tensor with shape of [N, T, C].
num_units: A list of two integers.
scope: Optional scope for `variable_scope`.
reuse: Boolean, whether to r... | def feedforward(inputs,
num_units,
scope="multihead_attention"):
'''Point-wise feed forward net.
Args:
inputs: A 3d tensor with shape of [N, T, C].
num_units: A list of two integers.
scope: Optional scope for `variable_scope`.
reuse: Boolean, whether to r... | [
"Point",
"-",
"wise",
"feed",
"forward",
"net",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/examples/trials/weight_sharing/ga_squad/graph_to_tf.py#L208-L240 | [
"def",
"feedforward",
"(",
"inputs",
",",
"num_units",
",",
"scope",
"=",
"\"multihead_attention\"",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"scope",
")",
":",
"# Inner layer",
"params",
"=",
"{",
"\"inputs\"",
":",
"inputs",
",",
"\"filters\"",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | generate | Generate search space.
Return a serializable search space object.
module_name: name of the module (str)
code: user code (str) | tools/nni_annotation/search_space_generator.py | def generate(module_name, code):
"""Generate search space.
Return a serializable search space object.
module_name: name of the module (str)
code: user code (str)
"""
try:
ast_tree = ast.parse(code)
except Exception:
raise RuntimeError('Bad Python code')
visitor = SearchS... | def generate(module_name, code):
"""Generate search space.
Return a serializable search space object.
module_name: name of the module (str)
code: user code (str)
"""
try:
ast_tree = ast.parse(code)
except Exception:
raise RuntimeError('Bad Python code')
visitor = SearchS... | [
"Generate",
"search",
"space",
".",
"Return",
"a",
"serializable",
"search",
"space",
"object",
".",
"module_name",
":",
"name",
"of",
"the",
"module",
"(",
"str",
")",
"code",
":",
"user",
"code",
"(",
"str",
")"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_annotation/search_space_generator.py#L114-L130 | [
"def",
"generate",
"(",
"module_name",
",",
"code",
")",
":",
"try",
":",
"ast_tree",
"=",
"ast",
".",
"parse",
"(",
"code",
")",
"except",
"Exception",
":",
"raise",
"RuntimeError",
"(",
"'Bad Python code'",
")",
"visitor",
"=",
"SearchSpaceGenerator",
"(",... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | rest_put | Call rest put method | tools/nni_cmd/rest_utils.py | def rest_put(url, data, timeout, show_error=False):
'''Call rest put method'''
try:
response = requests.put(url, headers={'Accept': 'application/json', 'Content-Type': 'application/json'},\
data=data, timeout=timeout)
return response
except Exception as except... | def rest_put(url, data, timeout, show_error=False):
'''Call rest put method'''
try:
response = requests.put(url, headers={'Accept': 'application/json', 'Content-Type': 'application/json'},\
data=data, timeout=timeout)
return response
except Exception as except... | [
"Call",
"rest",
"put",
"method"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/rest_utils.py#L28-L37 | [
"def",
"rest_put",
"(",
"url",
",",
"data",
",",
"timeout",
",",
"show_error",
"=",
"False",
")",
":",
"try",
":",
"response",
"=",
"requests",
".",
"put",
"(",
"url",
",",
"headers",
"=",
"{",
"'Accept'",
":",
"'application/json'",
",",
"'Content-Type'"... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | rest_post | Call rest post method | tools/nni_cmd/rest_utils.py | def rest_post(url, data, timeout, show_error=False):
'''Call rest post method'''
try:
response = requests.post(url, headers={'Accept': 'application/json', 'Content-Type': 'application/json'},\
data=data, timeout=timeout)
return response
except Exception as ex... | def rest_post(url, data, timeout, show_error=False):
'''Call rest post method'''
try:
response = requests.post(url, headers={'Accept': 'application/json', 'Content-Type': 'application/json'},\
data=data, timeout=timeout)
return response
except Exception as ex... | [
"Call",
"rest",
"post",
"method"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/rest_utils.py#L39-L48 | [
"def",
"rest_post",
"(",
"url",
",",
"data",
",",
"timeout",
",",
"show_error",
"=",
"False",
")",
":",
"try",
":",
"response",
"=",
"requests",
".",
"post",
"(",
"url",
",",
"headers",
"=",
"{",
"'Accept'",
":",
"'application/json'",
",",
"'Content-Type... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | rest_get | Call rest get method | tools/nni_cmd/rest_utils.py | def rest_get(url, timeout, show_error=False):
'''Call rest get method'''
try:
response = requests.get(url, timeout=timeout)
return response
except Exception as exception:
if show_error:
print_error(exception)
return None | def rest_get(url, timeout, show_error=False):
'''Call rest get method'''
try:
response = requests.get(url, timeout=timeout)
return response
except Exception as exception:
if show_error:
print_error(exception)
return None | [
"Call",
"rest",
"get",
"method"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/rest_utils.py#L50-L58 | [
"def",
"rest_get",
"(",
"url",
",",
"timeout",
",",
"show_error",
"=",
"False",
")",
":",
"try",
":",
"response",
"=",
"requests",
".",
"get",
"(",
"url",
",",
"timeout",
"=",
"timeout",
")",
"return",
"response",
"except",
"Exception",
"as",
"exception"... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | rest_delete | Call rest delete method | tools/nni_cmd/rest_utils.py | def rest_delete(url, timeout, show_error=False):
'''Call rest delete method'''
try:
response = requests.delete(url, timeout=timeout)
return response
except Exception as exception:
if show_error:
print_error(exception)
return None | def rest_delete(url, timeout, show_error=False):
'''Call rest delete method'''
try:
response = requests.delete(url, timeout=timeout)
return response
except Exception as exception:
if show_error:
print_error(exception)
return None | [
"Call",
"rest",
"delete",
"method"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/rest_utils.py#L60-L68 | [
"def",
"rest_delete",
"(",
"url",
",",
"timeout",
",",
"show_error",
"=",
"False",
")",
":",
"try",
":",
"response",
"=",
"requests",
".",
"delete",
"(",
"url",
",",
"timeout",
"=",
"timeout",
")",
"return",
"response",
"except",
"Exception",
"as",
"exce... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | check_rest_server | Check if restful server is ready | tools/nni_cmd/rest_utils.py | def check_rest_server(rest_port):
'''Check if restful server is ready'''
retry_count = 5
for _ in range(retry_count):
response = rest_get(check_status_url(rest_port), REST_TIME_OUT)
if response:
if response.status_code == 200:
return True, response
els... | def check_rest_server(rest_port):
'''Check if restful server is ready'''
retry_count = 5
for _ in range(retry_count):
response = rest_get(check_status_url(rest_port), REST_TIME_OUT)
if response:
if response.status_code == 200:
return True, response
els... | [
"Check",
"if",
"restful",
"server",
"is",
"ready"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/rest_utils.py#L70-L82 | [
"def",
"check_rest_server",
"(",
"rest_port",
")",
":",
"retry_count",
"=",
"5",
"for",
"_",
"in",
"range",
"(",
"retry_count",
")",
":",
"response",
"=",
"rest_get",
"(",
"check_status_url",
"(",
"rest_port",
")",
",",
"REST_TIME_OUT",
")",
"if",
"response"... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | check_rest_server_quick | Check if restful server is ready, only check once | tools/nni_cmd/rest_utils.py | def check_rest_server_quick(rest_port):
'''Check if restful server is ready, only check once'''
response = rest_get(check_status_url(rest_port), 5)
if response and response.status_code == 200:
return True, response
return False, None | def check_rest_server_quick(rest_port):
'''Check if restful server is ready, only check once'''
response = rest_get(check_status_url(rest_port), 5)
if response and response.status_code == 200:
return True, response
return False, None | [
"Check",
"if",
"restful",
"server",
"is",
"ready",
"only",
"check",
"once"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/rest_utils.py#L84-L89 | [
"def",
"check_rest_server_quick",
"(",
"rest_port",
")",
":",
"response",
"=",
"rest_get",
"(",
"check_status_url",
"(",
"rest_port",
")",
",",
"5",
")",
"if",
"response",
"and",
"response",
".",
"status_code",
"==",
"200",
":",
"return",
"True",
",",
"respo... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | vap | Vapor pressure model
Parameters
----------
x: int
a: float
b: float
c: float
Returns
-------
float
np.exp(a+b/x+c*np.log(x)) | src/sdk/pynni/nni/curvefitting_assessor/curvefunctions.py | def vap(x, a, b, c):
"""Vapor pressure model
Parameters
----------
x: int
a: float
b: float
c: float
Returns
-------
float
np.exp(a+b/x+c*np.log(x))
"""
return np.exp(a+b/x+c*np.log(x)) | def vap(x, a, b, c):
"""Vapor pressure model
Parameters
----------
x: int
a: float
b: float
c: float
Returns
-------
float
np.exp(a+b/x+c*np.log(x))
"""
return np.exp(a+b/x+c*np.log(x)) | [
"Vapor",
"pressure",
"model",
"Parameters",
"----------",
"x",
":",
"int",
"a",
":",
"float",
"b",
":",
"float",
"c",
":",
"float"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/curvefunctions.py#L27-L42 | [
"def",
"vap",
"(",
"x",
",",
"a",
",",
"b",
",",
"c",
")",
":",
"return",
"np",
".",
"exp",
"(",
"a",
"+",
"b",
"/",
"x",
"+",
"c",
"*",
"np",
".",
"log",
"(",
"x",
")",
")"
] | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | logx_linear | logx linear
Parameters
----------
x: int
a: float
b: float
Returns
-------
float
a * np.log(x) + b | src/sdk/pynni/nni/curvefitting_assessor/curvefunctions.py | def logx_linear(x, a, b):
"""logx linear
Parameters
----------
x: int
a: float
b: float
Returns
-------
float
a * np.log(x) + b
"""
x = np.log(x)
return a*x + b | def logx_linear(x, a, b):
"""logx linear
Parameters
----------
x: int
a: float
b: float
Returns
-------
float
a * np.log(x) + b
"""
x = np.log(x)
return a*x + b | [
"logx",
"linear"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/curvefunctions.py#L89-L104 | [
"def",
"logx_linear",
"(",
"x",
",",
"a",
",",
"b",
")",
":",
"x",
"=",
"np",
".",
"log",
"(",
"x",
")",
"return",
"a",
"*",
"x",
"+",
"b"
] | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | dr_hill_zero_background | dr hill zero background
Parameters
----------
x: int
theta: float
eta: float
kappa: float
Returns
-------
float
(theta* x**eta) / (kappa**eta + x**eta) | src/sdk/pynni/nni/curvefitting_assessor/curvefunctions.py | def dr_hill_zero_background(x, theta, eta, kappa):
"""dr hill zero background
Parameters
----------
x: int
theta: float
eta: float
kappa: float
Returns
-------
float
(theta* x**eta) / (kappa**eta + x**eta)
"""
return (theta* x**eta) / (kappa**eta + x**eta) | def dr_hill_zero_background(x, theta, eta, kappa):
"""dr hill zero background
Parameters
----------
x: int
theta: float
eta: float
kappa: float
Returns
-------
float
(theta* x**eta) / (kappa**eta + x**eta)
"""
return (theta* x**eta) / (kappa**eta + x**eta) | [
"dr",
"hill",
"zero",
"background",
"Parameters",
"----------",
"x",
":",
"int",
"theta",
":",
"float",
"eta",
":",
"float",
"kappa",
":",
"float"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/curvefunctions.py#L110-L125 | [
"def",
"dr_hill_zero_background",
"(",
"x",
",",
"theta",
",",
"eta",
",",
"kappa",
")",
":",
"return",
"(",
"theta",
"*",
"x",
"**",
"eta",
")",
"/",
"(",
"kappa",
"**",
"eta",
"+",
"x",
"**",
"eta",
")"
] | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | log_power | logistic power
Parameters
----------
x: int
a: float
b: float
c: float
Returns
-------
float
a/(1.+(x/np.exp(b))**c) | src/sdk/pynni/nni/curvefitting_assessor/curvefunctions.py | def log_power(x, a, b, c):
""""logistic power
Parameters
----------
x: int
a: float
b: float
c: float
Returns
-------
float
a/(1.+(x/np.exp(b))**c)
"""
return a/(1.+(x/np.exp(b))**c) | def log_power(x, a, b, c):
""""logistic power
Parameters
----------
x: int
a: float
b: float
c: float
Returns
-------
float
a/(1.+(x/np.exp(b))**c)
"""
return a/(1.+(x/np.exp(b))**c) | [
"logistic",
"power"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/curvefunctions.py#L131-L146 | [
"def",
"log_power",
"(",
"x",
",",
"a",
",",
"b",
",",
"c",
")",
":",
"return",
"a",
"/",
"(",
"1.",
"+",
"(",
"x",
"/",
"np",
".",
"exp",
"(",
"b",
")",
")",
"**",
"c",
")"
] | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | pow4 | pow4
Parameters
----------
x: int
alpha: float
a: float
b: float
c: float
Returns
-------
float
c - (a*x+b)**-alpha | src/sdk/pynni/nni/curvefitting_assessor/curvefunctions.py | def pow4(x, alpha, a, b, c):
"""pow4
Parameters
----------
x: int
alpha: float
a: float
b: float
c: float
Returns
-------
float
c - (a*x+b)**-alpha
"""
return c - (a*x+b)**-alpha | def pow4(x, alpha, a, b, c):
"""pow4
Parameters
----------
x: int
alpha: float
a: float
b: float
c: float
Returns
-------
float
c - (a*x+b)**-alpha
"""
return c - (a*x+b)**-alpha | [
"pow4"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/curvefunctions.py#L152-L168 | [
"def",
"pow4",
"(",
"x",
",",
"alpha",
",",
"a",
",",
"b",
",",
"c",
")",
":",
"return",
"c",
"-",
"(",
"a",
"*",
"x",
"+",
"b",
")",
"**",
"-",
"alpha"
] | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | mmf | Morgan-Mercer-Flodin
http://www.pisces-conservation.com/growthhelp/index.html?morgan_mercer_floden.htm
Parameters
----------
x: int
alpha: float
beta: float
kappa: float
delta: float
Returns
-------
float
alpha - (alpha - beta) / (1. + (kappa * x)**delta) | src/sdk/pynni/nni/curvefitting_assessor/curvefunctions.py | def mmf(x, alpha, beta, kappa, delta):
"""Morgan-Mercer-Flodin
http://www.pisces-conservation.com/growthhelp/index.html?morgan_mercer_floden.htm
Parameters
----------
x: int
alpha: float
beta: float
kappa: float
delta: float
Returns
-------
float
alpha - (alpha ... | def mmf(x, alpha, beta, kappa, delta):
"""Morgan-Mercer-Flodin
http://www.pisces-conservation.com/growthhelp/index.html?morgan_mercer_floden.htm
Parameters
----------
x: int
alpha: float
beta: float
kappa: float
delta: float
Returns
-------
float
alpha - (alpha ... | [
"Morgan",
"-",
"Mercer",
"-",
"Flodin",
"http",
":",
"//",
"www",
".",
"pisces",
"-",
"conservation",
".",
"com",
"/",
"growthhelp",
"/",
"index",
".",
"html?morgan_mercer_floden",
".",
"htm"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/curvefunctions.py#L174-L191 | [
"def",
"mmf",
"(",
"x",
",",
"alpha",
",",
"beta",
",",
"kappa",
",",
"delta",
")",
":",
"return",
"alpha",
"-",
"(",
"alpha",
"-",
"beta",
")",
"/",
"(",
"1.",
"+",
"(",
"kappa",
"*",
"x",
")",
"**",
"delta",
")"
] | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | exp4 | exp4
Parameters
----------
x: int
c: float
a: float
b: float
alpha: float
Returns
-------
float
c - np.exp(-a*(x**alpha)+b) | src/sdk/pynni/nni/curvefitting_assessor/curvefunctions.py | def exp4(x, c, a, b, alpha):
"""exp4
Parameters
----------
x: int
c: float
a: float
b: float
alpha: float
Returns
-------
float
c - np.exp(-a*(x**alpha)+b)
"""
return c - np.exp(-a*(x**alpha)+b) | def exp4(x, c, a, b, alpha):
"""exp4
Parameters
----------
x: int
c: float
a: float
b: float
alpha: float
Returns
-------
float
c - np.exp(-a*(x**alpha)+b)
"""
return c - np.exp(-a*(x**alpha)+b) | [
"exp4"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/curvefunctions.py#L197-L213 | [
"def",
"exp4",
"(",
"x",
",",
"c",
",",
"a",
",",
"b",
",",
"alpha",
")",
":",
"return",
"c",
"-",
"np",
".",
"exp",
"(",
"-",
"a",
"*",
"(",
"x",
"**",
"alpha",
")",
"+",
"b",
")"
] | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | weibull | Weibull model
http://www.pisces-conservation.com/growthhelp/index.html?morgan_mercer_floden.htm
Parameters
----------
x: int
alpha: float
beta: float
kappa: float
delta: float
Returns
-------
float
alpha - (alpha - beta) * np.exp(-(kappa * x)**delta) | src/sdk/pynni/nni/curvefitting_assessor/curvefunctions.py | def weibull(x, alpha, beta, kappa, delta):
"""Weibull model
http://www.pisces-conservation.com/growthhelp/index.html?morgan_mercer_floden.htm
Parameters
----------
x: int
alpha: float
beta: float
kappa: float
delta: float
Returns
-------
float
alpha - (alpha - b... | def weibull(x, alpha, beta, kappa, delta):
"""Weibull model
http://www.pisces-conservation.com/growthhelp/index.html?morgan_mercer_floden.htm
Parameters
----------
x: int
alpha: float
beta: float
kappa: float
delta: float
Returns
-------
float
alpha - (alpha - b... | [
"Weibull",
"model",
"http",
":",
"//",
"www",
".",
"pisces",
"-",
"conservation",
".",
"com",
"/",
"growthhelp",
"/",
"index",
".",
"html?morgan_mercer_floden",
".",
"htm"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/curvefunctions.py#L239-L256 | [
"def",
"weibull",
"(",
"x",
",",
"alpha",
",",
"beta",
",",
"kappa",
",",
"delta",
")",
":",
"return",
"alpha",
"-",
"(",
"alpha",
"-",
"beta",
")",
"*",
"np",
".",
"exp",
"(",
"-",
"(",
"kappa",
"*",
"x",
")",
"**",
"delta",
")"
] | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | janoschek | http://www.pisces-conservation.com/growthhelp/janoschek.htm
Parameters
----------
x: int
a: float
beta: float
k: float
delta: float
Returns
-------
float
a - (a - beta) * np.exp(-k*x**delta) | src/sdk/pynni/nni/curvefitting_assessor/curvefunctions.py | def janoschek(x, a, beta, k, delta):
"""http://www.pisces-conservation.com/growthhelp/janoschek.htm
Parameters
----------
x: int
a: float
beta: float
k: float
delta: float
Returns
-------
float
a - (a - beta) * np.exp(-k*x**delta)
"""
return a - (a - bet... | def janoschek(x, a, beta, k, delta):
"""http://www.pisces-conservation.com/growthhelp/janoschek.htm
Parameters
----------
x: int
a: float
beta: float
k: float
delta: float
Returns
-------
float
a - (a - beta) * np.exp(-k*x**delta)
"""
return a - (a - bet... | [
"http",
":",
"//",
"www",
".",
"pisces",
"-",
"conservation",
".",
"com",
"/",
"growthhelp",
"/",
"janoschek",
".",
"htm",
"Parameters",
"----------",
"x",
":",
"int",
"a",
":",
"float",
"beta",
":",
"float",
"k",
":",
"float",
"delta",
":",
"float"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/curvefunctions.py#L262-L278 | [
"def",
"janoschek",
"(",
"x",
",",
"a",
",",
"beta",
",",
"k",
",",
"delta",
")",
":",
"return",
"a",
"-",
"(",
"a",
"-",
"beta",
")",
"*",
"np",
".",
"exp",
"(",
"-",
"k",
"*",
"x",
"**",
"delta",
")"
] | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | parse_args | Definite the arguments users need to follow and input | tools/nni_cmd/nnictl.py | def parse_args():
'''Definite the arguments users need to follow and input'''
parser = argparse.ArgumentParser(prog='nnictl', description='use nnictl command to control nni experiments')
parser.add_argument('--version', '-v', action='store_true')
parser.set_defaults(func=nni_info)
# create subparse... | def parse_args():
'''Definite the arguments users need to follow and input'''
parser = argparse.ArgumentParser(prog='nnictl', description='use nnictl command to control nni experiments')
parser.add_argument('--version', '-v', action='store_true')
parser.set_defaults(func=nni_info)
# create subparse... | [
"Definite",
"the",
"arguments",
"users",
"need",
"to",
"follow",
"and",
"input"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/nnictl.py#L46-L198 | [
"def",
"parse_args",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"prog",
"=",
"'nnictl'",
",",
"description",
"=",
"'use nnictl command to control nni experiments'",
")",
"parser",
".",
"add_argument",
"(",
"'--version'",
",",
"'-v'",
","... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | get_log_path | generate stdout and stderr log path | tools/nni_cmd/launcher.py | def get_log_path(config_file_name):
'''generate stdout and stderr log path'''
stdout_full_path = os.path.join(NNICTL_HOME_DIR, config_file_name, 'stdout')
stderr_full_path = os.path.join(NNICTL_HOME_DIR, config_file_name, 'stderr')
return stdout_full_path, stderr_full_path | def get_log_path(config_file_name):
'''generate stdout and stderr log path'''
stdout_full_path = os.path.join(NNICTL_HOME_DIR, config_file_name, 'stdout')
stderr_full_path = os.path.join(NNICTL_HOME_DIR, config_file_name, 'stderr')
return stdout_full_path, stderr_full_path | [
"generate",
"stdout",
"and",
"stderr",
"log",
"path"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/launcher.py#L43-L47 | [
"def",
"get_log_path",
"(",
"config_file_name",
")",
":",
"stdout_full_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"NNICTL_HOME_DIR",
",",
"config_file_name",
",",
"'stdout'",
")",
"stderr_full_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"NNICTL_HOME... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | print_log_content | print log information | tools/nni_cmd/launcher.py | def print_log_content(config_file_name):
'''print log information'''
stdout_full_path, stderr_full_path = get_log_path(config_file_name)
print_normal(' Stdout:')
print(check_output_command(stdout_full_path))
print('\n\n')
print_normal(' Stderr:')
print(check_output_command(stderr_full_path)) | def print_log_content(config_file_name):
'''print log information'''
stdout_full_path, stderr_full_path = get_log_path(config_file_name)
print_normal(' Stdout:')
print(check_output_command(stdout_full_path))
print('\n\n')
print_normal(' Stderr:')
print(check_output_command(stderr_full_path)) | [
"print",
"log",
"information"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/launcher.py#L49-L56 | [
"def",
"print_log_content",
"(",
"config_file_name",
")",
":",
"stdout_full_path",
",",
"stderr_full_path",
"=",
"get_log_path",
"(",
"config_file_name",
")",
"print_normal",
"(",
"' Stdout:'",
")",
"print",
"(",
"check_output_command",
"(",
"stdout_full_path",
")",
"... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | get_nni_installation_path | Find nni lib from the following locations in order
Return nni root directory if it exists | tools/nni_cmd/launcher.py | def get_nni_installation_path():
''' Find nni lib from the following locations in order
Return nni root directory if it exists
'''
def try_installation_path_sequentially(*sitepackages):
'''Try different installation path sequentially util nni is found.
Return None if nothing is found
... | def get_nni_installation_path():
''' Find nni lib from the following locations in order
Return nni root directory if it exists
'''
def try_installation_path_sequentially(*sitepackages):
'''Try different installation path sequentially util nni is found.
Return None if nothing is found
... | [
"Find",
"nni",
"lib",
"from",
"the",
"following",
"locations",
"in",
"order",
"Return",
"nni",
"root",
"directory",
"if",
"it",
"exists"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/launcher.py#L58-L96 | [
"def",
"get_nni_installation_path",
"(",
")",
":",
"def",
"try_installation_path_sequentially",
"(",
"*",
"sitepackages",
")",
":",
"'''Try different installation path sequentially util nni is found.\n Return None if nothing is found\n '''",
"def",
"_generate_installation_p... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | start_rest_server | Run nni manager process | tools/nni_cmd/launcher.py | def start_rest_server(port, platform, mode, config_file_name, experiment_id=None, log_dir=None, log_level=None):
'''Run nni manager process'''
nni_config = Config(config_file_name)
if detect_port(port):
print_error('Port %s is used by another process, please reset the port!\n' \
'You could u... | def start_rest_server(port, platform, mode, config_file_name, experiment_id=None, log_dir=None, log_level=None):
'''Run nni manager process'''
nni_config = Config(config_file_name)
if detect_port(port):
print_error('Port %s is used by another process, please reset the port!\n' \
'You could u... | [
"Run",
"nni",
"manager",
"process"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/launcher.py#L98-L140 | [
"def",
"start_rest_server",
"(",
"port",
",",
"platform",
",",
"mode",
",",
"config_file_name",
",",
"experiment_id",
"=",
"None",
",",
"log_dir",
"=",
"None",
",",
"log_level",
"=",
"None",
")",
":",
"nni_config",
"=",
"Config",
"(",
"config_file_name",
")"... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | set_trial_config | set trial configuration | tools/nni_cmd/launcher.py | def set_trial_config(experiment_config, port, config_file_name):
'''set trial configuration'''
request_data = dict()
request_data['trial_config'] = experiment_config['trial']
response = rest_put(cluster_metadata_url(port), json.dumps(request_data), REST_TIME_OUT)
if check_response(response):
... | def set_trial_config(experiment_config, port, config_file_name):
'''set trial configuration'''
request_data = dict()
request_data['trial_config'] = experiment_config['trial']
response = rest_put(cluster_metadata_url(port), json.dumps(request_data), REST_TIME_OUT)
if check_response(response):
... | [
"set",
"trial",
"configuration"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/launcher.py#L142-L155 | [
"def",
"set_trial_config",
"(",
"experiment_config",
",",
"port",
",",
"config_file_name",
")",
":",
"request_data",
"=",
"dict",
"(",
")",
"request_data",
"[",
"'trial_config'",
"]",
"=",
"experiment_config",
"[",
"'trial'",
"]",
"response",
"=",
"rest_put",
"(... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | set_local_config | set local configuration | tools/nni_cmd/launcher.py | def set_local_config(experiment_config, port, config_file_name):
'''set local configuration'''
#set machine_list
request_data = dict()
if experiment_config.get('localConfig'):
request_data['local_config'] = experiment_config['localConfig']
if request_data['local_config'] and request_data... | def set_local_config(experiment_config, port, config_file_name):
'''set local configuration'''
#set machine_list
request_data = dict()
if experiment_config.get('localConfig'):
request_data['local_config'] = experiment_config['localConfig']
if request_data['local_config'] and request_data... | [
"set",
"local",
"configuration"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/launcher.py#L157-L176 | [
"def",
"set_local_config",
"(",
"experiment_config",
",",
"port",
",",
"config_file_name",
")",
":",
"#set machine_list",
"request_data",
"=",
"dict",
"(",
")",
"if",
"experiment_config",
".",
"get",
"(",
"'localConfig'",
")",
":",
"request_data",
"[",
"'local_con... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | set_remote_config | Call setClusterMetadata to pass trial | tools/nni_cmd/launcher.py | def set_remote_config(experiment_config, port, config_file_name):
'''Call setClusterMetadata to pass trial'''
#set machine_list
request_data = dict()
request_data['machine_list'] = experiment_config['machineList']
if request_data['machine_list']:
for i in range(len(request_data['machine_list... | def set_remote_config(experiment_config, port, config_file_name):
'''Call setClusterMetadata to pass trial'''
#set machine_list
request_data = dict()
request_data['machine_list'] = experiment_config['machineList']
if request_data['machine_list']:
for i in range(len(request_data['machine_list... | [
"Call",
"setClusterMetadata",
"to",
"pass",
"trial"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/launcher.py#L178-L200 | [
"def",
"set_remote_config",
"(",
"experiment_config",
",",
"port",
",",
"config_file_name",
")",
":",
"#set machine_list",
"request_data",
"=",
"dict",
"(",
")",
"request_data",
"[",
"'machine_list'",
"]",
"=",
"experiment_config",
"[",
"'machineList'",
"]",
"if",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | setNNIManagerIp | set nniManagerIp | tools/nni_cmd/launcher.py | def setNNIManagerIp(experiment_config, port, config_file_name):
'''set nniManagerIp'''
if experiment_config.get('nniManagerIp') is None:
return True, None
ip_config_dict = dict()
ip_config_dict['nni_manager_ip'] = { 'nniManagerIp' : experiment_config['nniManagerIp'] }
response = rest_put(clu... | def setNNIManagerIp(experiment_config, port, config_file_name):
'''set nniManagerIp'''
if experiment_config.get('nniManagerIp') is None:
return True, None
ip_config_dict = dict()
ip_config_dict['nni_manager_ip'] = { 'nniManagerIp' : experiment_config['nniManagerIp'] }
response = rest_put(clu... | [
"set",
"nniManagerIp"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/launcher.py#L202-L217 | [
"def",
"setNNIManagerIp",
"(",
"experiment_config",
",",
"port",
",",
"config_file_name",
")",
":",
"if",
"experiment_config",
".",
"get",
"(",
"'nniManagerIp'",
")",
"is",
"None",
":",
"return",
"True",
",",
"None",
"ip_config_dict",
"=",
"dict",
"(",
")",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | set_frameworkcontroller_config | set kubeflow configuration | tools/nni_cmd/launcher.py | def set_frameworkcontroller_config(experiment_config, port, config_file_name):
'''set kubeflow configuration'''
frameworkcontroller_config_data = dict()
frameworkcontroller_config_data['frameworkcontroller_config'] = experiment_config['frameworkcontrollerConfig']
response = rest_put(cluster_metadata_ur... | def set_frameworkcontroller_config(experiment_config, port, config_file_name):
'''set kubeflow configuration'''
frameworkcontroller_config_data = dict()
frameworkcontroller_config_data['frameworkcontroller_config'] = experiment_config['frameworkcontrollerConfig']
response = rest_put(cluster_metadata_ur... | [
"set",
"kubeflow",
"configuration"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/launcher.py#L257-L274 | [
"def",
"set_frameworkcontroller_config",
"(",
"experiment_config",
",",
"port",
",",
"config_file_name",
")",
":",
"frameworkcontroller_config_data",
"=",
"dict",
"(",
")",
"frameworkcontroller_config_data",
"[",
"'frameworkcontroller_config'",
"]",
"=",
"experiment_config",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | set_experiment | Call startExperiment (rest POST /experiment) with yaml file content | tools/nni_cmd/launcher.py | def set_experiment(experiment_config, mode, port, config_file_name):
'''Call startExperiment (rest POST /experiment) with yaml file content'''
request_data = dict()
request_data['authorName'] = experiment_config['authorName']
request_data['experimentName'] = experiment_config['experimentName']
reque... | def set_experiment(experiment_config, mode, port, config_file_name):
'''Call startExperiment (rest POST /experiment) with yaml file content'''
request_data = dict()
request_data['authorName'] = experiment_config['authorName']
request_data['experimentName'] = experiment_config['experimentName']
reque... | [
"Call",
"startExperiment",
"(",
"rest",
"POST",
"/",
"experiment",
")",
"with",
"yaml",
"file",
"content"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/launcher.py#L276-L341 | [
"def",
"set_experiment",
"(",
"experiment_config",
",",
"mode",
",",
"port",
",",
"config_file_name",
")",
":",
"request_data",
"=",
"dict",
"(",
")",
"request_data",
"[",
"'authorName'",
"]",
"=",
"experiment_config",
"[",
"'authorName'",
"]",
"request_data",
"... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | launch_experiment | follow steps to start rest server and start experiment | tools/nni_cmd/launcher.py | def launch_experiment(args, experiment_config, mode, config_file_name, experiment_id=None):
'''follow steps to start rest server and start experiment'''
nni_config = Config(config_file_name)
# check packages for tuner
if experiment_config.get('tuner') and experiment_config['tuner'].get('builtinTunerName... | def launch_experiment(args, experiment_config, mode, config_file_name, experiment_id=None):
'''follow steps to start rest server and start experiment'''
nni_config = Config(config_file_name)
# check packages for tuner
if experiment_config.get('tuner') and experiment_config['tuner'].get('builtinTunerName... | [
"follow",
"steps",
"to",
"start",
"rest",
"server",
"and",
"start",
"experiment"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/launcher.py#L343-L492 | [
"def",
"launch_experiment",
"(",
"args",
",",
"experiment_config",
",",
"mode",
",",
"config_file_name",
",",
"experiment_id",
"=",
"None",
")",
":",
"nni_config",
"=",
"Config",
"(",
"config_file_name",
")",
"# check packages for tuner",
"if",
"experiment_config",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | resume_experiment | resume an experiment | tools/nni_cmd/launcher.py | def resume_experiment(args):
'''resume an experiment'''
experiment_config = Experiments()
experiment_dict = experiment_config.get_all_experiments()
experiment_id = None
experiment_endTime = None
#find the latest stopped experiment
if not args.id:
print_error('Please set experiment id... | def resume_experiment(args):
'''resume an experiment'''
experiment_config = Experiments()
experiment_dict = experiment_config.get_all_experiments()
experiment_id = None
experiment_endTime = None
#find the latest stopped experiment
if not args.id:
print_error('Please set experiment id... | [
"resume",
"an",
"experiment"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/launcher.py#L494-L521 | [
"def",
"resume_experiment",
"(",
"args",
")",
":",
"experiment_config",
"=",
"Experiments",
"(",
")",
"experiment_dict",
"=",
"experiment_config",
".",
"get_all_experiments",
"(",
")",
"experiment_id",
"=",
"None",
"experiment_endTime",
"=",
"None",
"#find the latest ... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | create_experiment | start a new experiment | tools/nni_cmd/launcher.py | def create_experiment(args):
'''start a new experiment'''
config_file_name = ''.join(random.sample(string.ascii_letters + string.digits, 8))
nni_config = Config(config_file_name)
config_path = os.path.abspath(args.config)
if not os.path.exists(config_path):
print_error('Please set correct co... | def create_experiment(args):
'''start a new experiment'''
config_file_name = ''.join(random.sample(string.ascii_letters + string.digits, 8))
nni_config = Config(config_file_name)
config_path = os.path.abspath(args.config)
if not os.path.exists(config_path):
print_error('Please set correct co... | [
"start",
"a",
"new",
"experiment"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/launcher.py#L523-L536 | [
"def",
"create_experiment",
"(",
"args",
")",
":",
"config_file_name",
"=",
"''",
".",
"join",
"(",
"random",
".",
"sample",
"(",
"string",
".",
"ascii_letters",
"+",
"string",
".",
"digits",
",",
"8",
")",
")",
"nni_config",
"=",
"Config",
"(",
"config_... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | CurveModel.fit_theta | use least squares to fit all default curves parameter seperately
Returns
-------
None | src/sdk/pynni/nni/curvefitting_assessor/model_factory.py | def fit_theta(self):
"""use least squares to fit all default curves parameter seperately
Returns
-------
None
"""
x = range(1, self.point_num + 1)
y = self.trial_history
for i in range(NUM_OF_FUNCTIONS):
model = curve_combination_model... | def fit_theta(self):
"""use least squares to fit all default curves parameter seperately
Returns
-------
None
"""
x = range(1, self.point_num + 1)
y = self.trial_history
for i in range(NUM_OF_FUNCTIONS):
model = curve_combination_model... | [
"use",
"least",
"squares",
"to",
"fit",
"all",
"default",
"curves",
"parameter",
"seperately",
"Returns",
"-------",
"None"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/model_factory.py#L54-L86 | [
"def",
"fit_theta",
"(",
"self",
")",
":",
"x",
"=",
"range",
"(",
"1",
",",
"self",
".",
"point_num",
"+",
"1",
")",
"y",
"=",
"self",
".",
"trial_history",
"for",
"i",
"in",
"range",
"(",
"NUM_OF_FUNCTIONS",
")",
":",
"model",
"=",
"curve_combinati... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | CurveModel.filter_curve | filter the poor performing curve
Returns
-------
None | src/sdk/pynni/nni/curvefitting_assessor/model_factory.py | def filter_curve(self):
"""filter the poor performing curve
Returns
-------
None
"""
avg = np.sum(self.trial_history) / self.point_num
standard = avg * avg * self.point_num
predict_data = []
tmp_model = []
for i in range(NUM_OF_FUN... | def filter_curve(self):
"""filter the poor performing curve
Returns
-------
None
"""
avg = np.sum(self.trial_history) / self.point_num
standard = avg * avg * self.point_num
predict_data = []
tmp_model = []
for i in range(NUM_OF_FUN... | [
"filter",
"the",
"poor",
"performing",
"curve",
"Returns",
"-------",
"None"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/model_factory.py#L88-L116 | [
"def",
"filter_curve",
"(",
"self",
")",
":",
"avg",
"=",
"np",
".",
"sum",
"(",
"self",
".",
"trial_history",
")",
"/",
"self",
".",
"point_num",
"standard",
"=",
"avg",
"*",
"avg",
"*",
"self",
".",
"point_num",
"predict_data",
"=",
"[",
"]",
"tmp_... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | CurveModel.predict_y | return the predict y of 'model' when epoch = pos
Parameters
----------
model: string
name of the curve function model
pos: int
the epoch number of the position you want to predict
Returns
-------
int:
The expected matr... | src/sdk/pynni/nni/curvefitting_assessor/model_factory.py | def predict_y(self, model, pos):
"""return the predict y of 'model' when epoch = pos
Parameters
----------
model: string
name of the curve function model
pos: int
the epoch number of the position you want to predict
Returns
------... | def predict_y(self, model, pos):
"""return the predict y of 'model' when epoch = pos
Parameters
----------
model: string
name of the curve function model
pos: int
the epoch number of the position you want to predict
Returns
------... | [
"return",
"the",
"predict",
"y",
"of",
"model",
"when",
"epoch",
"=",
"pos",
"Parameters",
"----------",
"model",
":",
"string",
"name",
"of",
"the",
"curve",
"function",
"model",
"pos",
":",
"int",
"the",
"epoch",
"number",
"of",
"the",
"position",
"you",... | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/model_factory.py#L118-L139 | [
"def",
"predict_y",
"(",
"self",
",",
"model",
",",
"pos",
")",
":",
"if",
"model_para_num",
"[",
"model",
"]",
"==",
"2",
":",
"y",
"=",
"all_models",
"[",
"model",
"]",
"(",
"pos",
",",
"model_para",
"[",
"model",
"]",
"[",
"0",
"]",
",",
"mode... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | CurveModel.f_comb | return the value of the f_comb when epoch = pos
Parameters
----------
pos: int
the epoch number of the position you want to predict
sample: list
sample is a (1 * NUM_OF_FUNCTIONS) matrix, representing{w1, w2, ... wk}
Returns
-------
int
... | src/sdk/pynni/nni/curvefitting_assessor/model_factory.py | def f_comb(self, pos, sample):
"""return the value of the f_comb when epoch = pos
Parameters
----------
pos: int
the epoch number of the position you want to predict
sample: list
sample is a (1 * NUM_OF_FUNCTIONS) matrix, representing{w1, w2, ... wk}
... | def f_comb(self, pos, sample):
"""return the value of the f_comb when epoch = pos
Parameters
----------
pos: int
the epoch number of the position you want to predict
sample: list
sample is a (1 * NUM_OF_FUNCTIONS) matrix, representing{w1, w2, ... wk}
... | [
"return",
"the",
"value",
"of",
"the",
"f_comb",
"when",
"epoch",
"=",
"pos"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/model_factory.py#L141-L161 | [
"def",
"f_comb",
"(",
"self",
",",
"pos",
",",
"sample",
")",
":",
"ret",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"effective_model_num",
")",
":",
"model",
"=",
"self",
".",
"effective_model",
"[",
"i",
"]",
"y",
"=",
"self",
".",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | CurveModel.normalize_weight | normalize weight
Parameters
----------
samples: list
a collection of sample, it's a (NUM_OF_INSTANCE * NUM_OF_FUNCTIONS) matrix,
representing{{w11, w12, ..., w1k}, {w21, w22, ... w2k}, ...{wk1, wk2,..., wkk}}
Returns
-------
list
... | src/sdk/pynni/nni/curvefitting_assessor/model_factory.py | def normalize_weight(self, samples):
"""normalize weight
Parameters
----------
samples: list
a collection of sample, it's a (NUM_OF_INSTANCE * NUM_OF_FUNCTIONS) matrix,
representing{{w11, w12, ..., w1k}, {w21, w22, ... w2k}, ...{wk1, wk2,..., wkk}}
... | def normalize_weight(self, samples):
"""normalize weight
Parameters
----------
samples: list
a collection of sample, it's a (NUM_OF_INSTANCE * NUM_OF_FUNCTIONS) matrix,
representing{{w11, w12, ..., w1k}, {w21, w22, ... w2k}, ...{wk1, wk2,..., wkk}}
... | [
"normalize",
"weight",
"Parameters",
"----------",
"samples",
":",
"list",
"a",
"collection",
"of",
"sample",
"it",
"s",
"a",
"(",
"NUM_OF_INSTANCE",
"*",
"NUM_OF_FUNCTIONS",
")",
"matrix",
"representing",
"{{",
"w11",
"w12",
"...",
"w1k",
"}",
"{",
"w21",
"... | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/model_factory.py#L163-L183 | [
"def",
"normalize_weight",
"(",
"self",
",",
"samples",
")",
":",
"for",
"i",
"in",
"range",
"(",
"NUM_OF_INSTANCE",
")",
":",
"total",
"=",
"0",
"for",
"j",
"in",
"range",
"(",
"self",
".",
"effective_model_num",
")",
":",
"total",
"+=",
"samples",
"[... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | CurveModel.sigma_sq | returns the value of sigma square, given the weight's sample
Parameters
----------
sample: list
sample is a (1 * NUM_OF_FUNCTIONS) matrix, representing{w1, w2, ... wk}
Returns
-------
float
the value of sigma square, given the weight's sa... | src/sdk/pynni/nni/curvefitting_assessor/model_factory.py | def sigma_sq(self, sample):
"""returns the value of sigma square, given the weight's sample
Parameters
----------
sample: list
sample is a (1 * NUM_OF_FUNCTIONS) matrix, representing{w1, w2, ... wk}
Returns
-------
float
the value... | def sigma_sq(self, sample):
"""returns the value of sigma square, given the weight's sample
Parameters
----------
sample: list
sample is a (1 * NUM_OF_FUNCTIONS) matrix, representing{w1, w2, ... wk}
Returns
-------
float
the value... | [
"returns",
"the",
"value",
"of",
"sigma",
"square",
"given",
"the",
"weight",
"s",
"sample",
"Parameters",
"----------",
"sample",
":",
"list",
"sample",
"is",
"a",
"(",
"1",
"*",
"NUM_OF_FUNCTIONS",
")",
"matrix",
"representing",
"{",
"w1",
"w2",
"...",
"... | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/model_factory.py#L185-L202 | [
"def",
"sigma_sq",
"(",
"self",
",",
"sample",
")",
":",
"ret",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"self",
".",
"point_num",
"+",
"1",
")",
":",
"temp",
"=",
"self",
".",
"trial_history",
"[",
"i",
"-",
"1",
"]",
"-",
"self",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | CurveModel.normal_distribution | returns the value of normal distribution, given the weight's sample and target position
Parameters
----------
pos: int
the epoch number of the position you want to predict
sample: list
sample is a (1 * NUM_OF_FUNCTIONS) matrix, representing{w1, w2, ... wk... | src/sdk/pynni/nni/curvefitting_assessor/model_factory.py | def normal_distribution(self, pos, sample):
"""returns the value of normal distribution, given the weight's sample and target position
Parameters
----------
pos: int
the epoch number of the position you want to predict
sample: list
sample is a (1 ... | def normal_distribution(self, pos, sample):
"""returns the value of normal distribution, given the weight's sample and target position
Parameters
----------
pos: int
the epoch number of the position you want to predict
sample: list
sample is a (1 ... | [
"returns",
"the",
"value",
"of",
"normal",
"distribution",
"given",
"the",
"weight",
"s",
"sample",
"and",
"target",
"position",
"Parameters",
"----------",
"pos",
":",
"int",
"the",
"epoch",
"number",
"of",
"the",
"position",
"you",
"want",
"to",
"predict",
... | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/model_factory.py#L204-L221 | [
"def",
"normal_distribution",
"(",
"self",
",",
"pos",
",",
"sample",
")",
":",
"curr_sigma_sq",
"=",
"self",
".",
"sigma_sq",
"(",
"sample",
")",
"delta",
"=",
"self",
".",
"trial_history",
"[",
"pos",
"-",
"1",
"]",
"-",
"self",
".",
"f_comb",
"(",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | CurveModel.likelihood | likelihood
Parameters
----------
sample: list
sample is a (1 * NUM_OF_FUNCTIONS) matrix, representing{w1, w2, ... wk}
Returns
-------
float
likelihood | src/sdk/pynni/nni/curvefitting_assessor/model_factory.py | def likelihood(self, samples):
"""likelihood
Parameters
----------
sample: list
sample is a (1 * NUM_OF_FUNCTIONS) matrix, representing{w1, w2, ... wk}
Returns
-------
float
likelihood
"""
ret = np.ones(NUM_OF_INST... | def likelihood(self, samples):
"""likelihood
Parameters
----------
sample: list
sample is a (1 * NUM_OF_FUNCTIONS) matrix, representing{w1, w2, ... wk}
Returns
-------
float
likelihood
"""
ret = np.ones(NUM_OF_INST... | [
"likelihood"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/model_factory.py#L223-L240 | [
"def",
"likelihood",
"(",
"self",
",",
"samples",
")",
":",
"ret",
"=",
"np",
".",
"ones",
"(",
"NUM_OF_INSTANCE",
")",
"for",
"i",
"in",
"range",
"(",
"NUM_OF_INSTANCE",
")",
":",
"for",
"j",
"in",
"range",
"(",
"1",
",",
"self",
".",
"point_num",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | CurveModel.prior | priori distribution
Parameters
----------
samples: list
a collection of sample, it's a (NUM_OF_INSTANCE * NUM_OF_FUNCTIONS) matrix,
representing{{w11, w12, ..., w1k}, {w21, w22, ... w2k}, ...{wk1, wk2,..., wkk}}
Returns
-------
float
... | src/sdk/pynni/nni/curvefitting_assessor/model_factory.py | def prior(self, samples):
"""priori distribution
Parameters
----------
samples: list
a collection of sample, it's a (NUM_OF_INSTANCE * NUM_OF_FUNCTIONS) matrix,
representing{{w11, w12, ..., w1k}, {w21, w22, ... w2k}, ...{wk1, wk2,..., wkk}}
Retu... | def prior(self, samples):
"""priori distribution
Parameters
----------
samples: list
a collection of sample, it's a (NUM_OF_INSTANCE * NUM_OF_FUNCTIONS) matrix,
representing{{w11, w12, ..., w1k}, {w21, w22, ... w2k}, ...{wk1, wk2,..., wkk}}
Retu... | [
"priori",
"distribution",
"Parameters",
"----------",
"samples",
":",
"list",
"a",
"collection",
"of",
"sample",
"it",
"s",
"a",
"(",
"NUM_OF_INSTANCE",
"*",
"NUM_OF_FUNCTIONS",
")",
"matrix",
"representing",
"{{",
"w11",
"w12",
"...",
"w1k",
"}",
"{",
"w21",
... | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/model_factory.py#L242-L263 | [
"def",
"prior",
"(",
"self",
",",
"samples",
")",
":",
"ret",
"=",
"np",
".",
"ones",
"(",
"NUM_OF_INSTANCE",
")",
"for",
"i",
"in",
"range",
"(",
"NUM_OF_INSTANCE",
")",
":",
"for",
"j",
"in",
"range",
"(",
"self",
".",
"effective_model_num",
")",
"... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | CurveModel.target_distribution | posterior probability
Parameters
----------
samples: list
a collection of sample, it's a (NUM_OF_INSTANCE * NUM_OF_FUNCTIONS) matrix,
representing{{w11, w12, ..., w1k}, {w21, w22, ... w2k}, ...{wk1, wk2,..., wkk}}
Returns
-------
... | src/sdk/pynni/nni/curvefitting_assessor/model_factory.py | def target_distribution(self, samples):
"""posterior probability
Parameters
----------
samples: list
a collection of sample, it's a (NUM_OF_INSTANCE * NUM_OF_FUNCTIONS) matrix,
representing{{w11, w12, ..., w1k}, {w21, w22, ... w2k}, ...{wk1, wk2,..., wkk}... | def target_distribution(self, samples):
"""posterior probability
Parameters
----------
samples: list
a collection of sample, it's a (NUM_OF_INSTANCE * NUM_OF_FUNCTIONS) matrix,
representing{{w11, w12, ..., w1k}, {w21, w22, ... w2k}, ...{wk1, wk2,..., wkk}... | [
"posterior",
"probability",
"Parameters",
"----------",
"samples",
":",
"list",
"a",
"collection",
"of",
"sample",
"it",
"s",
"a",
"(",
"NUM_OF_INSTANCE",
"*",
"NUM_OF_FUNCTIONS",
")",
"matrix",
"representing",
"{{",
"w11",
"w12",
"...",
"w1k",
"}",
"{",
"w21"... | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/model_factory.py#L265-L284 | [
"def",
"target_distribution",
"(",
"self",
",",
"samples",
")",
":",
"curr_likelihood",
"=",
"self",
".",
"likelihood",
"(",
"samples",
")",
"curr_prior",
"=",
"self",
".",
"prior",
"(",
"samples",
")",
"ret",
"=",
"np",
".",
"ones",
"(",
"NUM_OF_INSTANCE"... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | CurveModel.mcmc_sampling | Adjust the weight of each function using mcmc sampling.
The initial value of each weight is evenly distribute.
Brief introduction:
(1)Definition of sample:
Sample is a (1 * NUM_OF_FUNCTIONS) matrix, representing{w1, w2, ... wk}
(2)Definition of samples:
Samples is... | src/sdk/pynni/nni/curvefitting_assessor/model_factory.py | def mcmc_sampling(self):
"""Adjust the weight of each function using mcmc sampling.
The initial value of each weight is evenly distribute.
Brief introduction:
(1)Definition of sample:
Sample is a (1 * NUM_OF_FUNCTIONS) matrix, representing{w1, w2, ... wk}
(2)Definitio... | def mcmc_sampling(self):
"""Adjust the weight of each function using mcmc sampling.
The initial value of each weight is evenly distribute.
Brief introduction:
(1)Definition of sample:
Sample is a (1 * NUM_OF_FUNCTIONS) matrix, representing{w1, w2, ... wk}
(2)Definitio... | [
"Adjust",
"the",
"weight",
"of",
"each",
"function",
"using",
"mcmc",
"sampling",
".",
"The",
"initial",
"value",
"of",
"each",
"weight",
"is",
"evenly",
"distribute",
".",
"Brief",
"introduction",
":",
"(",
"1",
")",
"Definition",
"of",
"sample",
":",
"Sa... | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/model_factory.py#L286-L318 | [
"def",
"mcmc_sampling",
"(",
"self",
")",
":",
"init_weight",
"=",
"np",
".",
"ones",
"(",
"(",
"self",
".",
"effective_model_num",
")",
",",
"dtype",
"=",
"np",
".",
"float",
")",
"/",
"self",
".",
"effective_model_num",
"self",
".",
"weight_samples",
"... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | CurveModel.predict | predict the value of target position
Parameters
----------
trial_history: list
The history performance matrix of each trial.
Returns
-------
float
expected final result performance of this hyperparameter config | src/sdk/pynni/nni/curvefitting_assessor/model_factory.py | def predict(self, trial_history):
"""predict the value of target position
Parameters
----------
trial_history: list
The history performance matrix of each trial.
Returns
-------
float
expected final result performance of this hype... | def predict(self, trial_history):
"""predict the value of target position
Parameters
----------
trial_history: list
The history performance matrix of each trial.
Returns
-------
float
expected final result performance of this hype... | [
"predict",
"the",
"value",
"of",
"target",
"position",
"Parameters",
"----------",
"trial_history",
":",
"list",
"The",
"history",
"performance",
"matrix",
"of",
"each",
"trial",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/curvefitting_assessor/model_factory.py#L320-L344 | [
"def",
"predict",
"(",
"self",
",",
"trial_history",
")",
":",
"self",
".",
"trial_history",
"=",
"trial_history",
"self",
".",
"point_num",
"=",
"len",
"(",
"trial_history",
")",
"self",
".",
"fit_theta",
"(",
")",
"self",
".",
"filter_curve",
"(",
")",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | _outlierDetection_threaded | Detect the outlier | src/sdk/pynni/nni/metis_tuner/Regression_GP/OutlierDetection.py | def _outlierDetection_threaded(inputs):
'''
Detect the outlier
'''
[samples_idx, samples_x, samples_y_aggregation] = inputs
sys.stderr.write("[%s] DEBUG: Evaluating %dth of %d samples\n"\
% (os.path.basename(__file__), samples_idx + 1, len(samples_x)))
outlier = None
... | def _outlierDetection_threaded(inputs):
'''
Detect the outlier
'''
[samples_idx, samples_x, samples_y_aggregation] = inputs
sys.stderr.write("[%s] DEBUG: Evaluating %dth of %d samples\n"\
% (os.path.basename(__file__), samples_idx + 1, len(samples_x)))
outlier = None
... | [
"Detect",
"the",
"outlier"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/metis_tuner/Regression_GP/OutlierDetection.py#L32-L53 | [
"def",
"_outlierDetection_threaded",
"(",
"inputs",
")",
":",
"[",
"samples_idx",
",",
"samples_x",
",",
"samples_y_aggregation",
"]",
"=",
"inputs",
"sys",
".",
"stderr",
".",
"write",
"(",
"\"[%s] DEBUG: Evaluating %dth of %d samples\\n\"",
"%",
"(",
"os",
".",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | outlierDetection_threaded | Use Multi-thread to detect the outlier | src/sdk/pynni/nni/metis_tuner/Regression_GP/OutlierDetection.py | def outlierDetection_threaded(samples_x, samples_y_aggregation):
'''
Use Multi-thread to detect the outlier
'''
outliers = []
threads_inputs = [[samples_idx, samples_x, samples_y_aggregation]\
for samples_idx in range(0, len(samples_x))]
threads_pool = ThreadPool(min... | def outlierDetection_threaded(samples_x, samples_y_aggregation):
'''
Use Multi-thread to detect the outlier
'''
outliers = []
threads_inputs = [[samples_idx, samples_x, samples_y_aggregation]\
for samples_idx in range(0, len(samples_x))]
threads_pool = ThreadPool(min... | [
"Use",
"Multi",
"-",
"thread",
"to",
"detect",
"the",
"outlier"
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/metis_tuner/Regression_GP/OutlierDetection.py#L55-L75 | [
"def",
"outlierDetection_threaded",
"(",
"samples_x",
",",
"samples_y_aggregation",
")",
":",
"outliers",
"=",
"[",
"]",
"threads_inputs",
"=",
"[",
"[",
"samples_idx",
",",
"samples_x",
",",
"samples_y_aggregation",
"]",
"for",
"samples_idx",
"in",
"range",
"(",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | deeper_conv_block | deeper conv layer. | src/sdk/pynni/nni/networkmorphism_tuner/layer_transformer.py | def deeper_conv_block(conv_layer, kernel_size, weighted=True):
'''deeper conv layer.
'''
n_dim = get_n_dim(conv_layer)
filter_shape = (kernel_size,) * 2
n_filters = conv_layer.filters
weight = np.zeros((n_filters, n_filters) + filter_shape)
center = tuple(map(lambda x: int((x - 1) / 2), filt... | def deeper_conv_block(conv_layer, kernel_size, weighted=True):
'''deeper conv layer.
'''
n_dim = get_n_dim(conv_layer)
filter_shape = (kernel_size,) * 2
n_filters = conv_layer.filters
weight = np.zeros((n_filters, n_filters) + filter_shape)
center = tuple(map(lambda x: int((x - 1) / 2), filt... | [
"deeper",
"conv",
"layer",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/layer_transformer.py#L34-L65 | [
"def",
"deeper_conv_block",
"(",
"conv_layer",
",",
"kernel_size",
",",
"weighted",
"=",
"True",
")",
":",
"n_dim",
"=",
"get_n_dim",
"(",
"conv_layer",
")",
"filter_shape",
"=",
"(",
"kernel_size",
",",
")",
"*",
"2",
"n_filters",
"=",
"conv_layer",
".",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | dense_to_deeper_block | deeper dense layer. | src/sdk/pynni/nni/networkmorphism_tuner/layer_transformer.py | def dense_to_deeper_block(dense_layer, weighted=True):
'''deeper dense layer.
'''
units = dense_layer.units
weight = np.eye(units)
bias = np.zeros(units)
new_dense_layer = StubDense(units, units)
if weighted:
new_dense_layer.set_weights(
(add_noise(weight, np.array([0, 1]... | def dense_to_deeper_block(dense_layer, weighted=True):
'''deeper dense layer.
'''
units = dense_layer.units
weight = np.eye(units)
bias = np.zeros(units)
new_dense_layer = StubDense(units, units)
if weighted:
new_dense_layer.set_weights(
(add_noise(weight, np.array([0, 1]... | [
"deeper",
"dense",
"layer",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/layer_transformer.py#L68-L79 | [
"def",
"dense_to_deeper_block",
"(",
"dense_layer",
",",
"weighted",
"=",
"True",
")",
":",
"units",
"=",
"dense_layer",
".",
"units",
"weight",
"=",
"np",
".",
"eye",
"(",
"units",
")",
"bias",
"=",
"np",
".",
"zeros",
"(",
"units",
")",
"new_dense_laye... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | wider_pre_dense | wider previous dense layer. | src/sdk/pynni/nni/networkmorphism_tuner/layer_transformer.py | def wider_pre_dense(layer, n_add, weighted=True):
'''wider previous dense layer.
'''
if not weighted:
return StubDense(layer.input_units, layer.units + n_add)
n_units2 = layer.units
teacher_w, teacher_b = layer.get_weights()
rand = np.random.randint(n_units2, size=n_add)
student_w ... | def wider_pre_dense(layer, n_add, weighted=True):
'''wider previous dense layer.
'''
if not weighted:
return StubDense(layer.input_units, layer.units + n_add)
n_units2 = layer.units
teacher_w, teacher_b = layer.get_weights()
rand = np.random.randint(n_units2, size=n_add)
student_w ... | [
"wider",
"previous",
"dense",
"layer",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/layer_transformer.py#L82-L106 | [
"def",
"wider_pre_dense",
"(",
"layer",
",",
"n_add",
",",
"weighted",
"=",
"True",
")",
":",
"if",
"not",
"weighted",
":",
"return",
"StubDense",
"(",
"layer",
".",
"input_units",
",",
"layer",
".",
"units",
"+",
"n_add",
")",
"n_units2",
"=",
"layer",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | wider_pre_conv | wider previous conv layer. | src/sdk/pynni/nni/networkmorphism_tuner/layer_transformer.py | def wider_pre_conv(layer, n_add_filters, weighted=True):
'''wider previous conv layer.
'''
n_dim = get_n_dim(layer)
if not weighted:
return get_conv_class(n_dim)(
layer.input_channel,
layer.filters + n_add_filters,
kernel_size=layer.kernel_size,
)
... | def wider_pre_conv(layer, n_add_filters, weighted=True):
'''wider previous conv layer.
'''
n_dim = get_n_dim(layer)
if not weighted:
return get_conv_class(n_dim)(
layer.input_channel,
layer.filters + n_add_filters,
kernel_size=layer.kernel_size,
)
... | [
"wider",
"previous",
"conv",
"layer",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/layer_transformer.py#L109-L139 | [
"def",
"wider_pre_conv",
"(",
"layer",
",",
"n_add_filters",
",",
"weighted",
"=",
"True",
")",
":",
"n_dim",
"=",
"get_n_dim",
"(",
"layer",
")",
"if",
"not",
"weighted",
":",
"return",
"get_conv_class",
"(",
"n_dim",
")",
"(",
"layer",
".",
"input_channe... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | wider_next_conv | wider next conv layer. | src/sdk/pynni/nni/networkmorphism_tuner/layer_transformer.py | def wider_next_conv(layer, start_dim, total_dim, n_add, weighted=True):
'''wider next conv layer.
'''
n_dim = get_n_dim(layer)
if not weighted:
return get_conv_class(n_dim)(layer.input_channel + n_add,
layer.filters,
kerne... | def wider_next_conv(layer, start_dim, total_dim, n_add, weighted=True):
'''wider next conv layer.
'''
n_dim = get_n_dim(layer)
if not weighted:
return get_conv_class(n_dim)(layer.input_channel + n_add,
layer.filters,
kerne... | [
"wider",
"next",
"conv",
"layer",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/layer_transformer.py#L142-L166 | [
"def",
"wider_next_conv",
"(",
"layer",
",",
"start_dim",
",",
"total_dim",
",",
"n_add",
",",
"weighted",
"=",
"True",
")",
":",
"n_dim",
"=",
"get_n_dim",
"(",
"layer",
")",
"if",
"not",
"weighted",
":",
"return",
"get_conv_class",
"(",
"n_dim",
")",
"... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | wider_bn | wider batch norm layer. | src/sdk/pynni/nni/networkmorphism_tuner/layer_transformer.py | def wider_bn(layer, start_dim, total_dim, n_add, weighted=True):
'''wider batch norm layer.
'''
n_dim = get_n_dim(layer)
if not weighted:
return get_batch_norm_class(n_dim)(layer.num_features + n_add)
weights = layer.get_weights()
new_weights = [
add_noise(np.ones(n_add, dtype=... | def wider_bn(layer, start_dim, total_dim, n_add, weighted=True):
'''wider batch norm layer.
'''
n_dim = get_n_dim(layer)
if not weighted:
return get_batch_norm_class(n_dim)(layer.num_features + n_add)
weights = layer.get_weights()
new_weights = [
add_noise(np.ones(n_add, dtype=... | [
"wider",
"batch",
"norm",
"layer",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/layer_transformer.py#L169-L194 | [
"def",
"wider_bn",
"(",
"layer",
",",
"start_dim",
",",
"total_dim",
",",
"n_add",
",",
"weighted",
"=",
"True",
")",
":",
"n_dim",
"=",
"get_n_dim",
"(",
"layer",
")",
"if",
"not",
"weighted",
":",
"return",
"get_batch_norm_class",
"(",
"n_dim",
")",
"(... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | wider_next_dense | wider next dense layer. | src/sdk/pynni/nni/networkmorphism_tuner/layer_transformer.py | def wider_next_dense(layer, start_dim, total_dim, n_add, weighted=True):
'''wider next dense layer.
'''
if not weighted:
return StubDense(layer.input_units + n_add, layer.units)
teacher_w, teacher_b = layer.get_weights()
student_w = teacher_w.copy()
n_units_each_channel = int(teacher_w.s... | def wider_next_dense(layer, start_dim, total_dim, n_add, weighted=True):
'''wider next dense layer.
'''
if not weighted:
return StubDense(layer.input_units + n_add, layer.units)
teacher_w, teacher_b = layer.get_weights()
student_w = teacher_w.copy()
n_units_each_channel = int(teacher_w.s... | [
"wider",
"next",
"dense",
"layer",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/layer_transformer.py#L197-L220 | [
"def",
"wider_next_dense",
"(",
"layer",
",",
"start_dim",
",",
"total_dim",
",",
"n_add",
",",
"weighted",
"=",
"True",
")",
":",
"if",
"not",
"weighted",
":",
"return",
"StubDense",
"(",
"layer",
".",
"input_units",
"+",
"n_add",
",",
"layer",
".",
"un... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | add_noise | add noise to the layer. | src/sdk/pynni/nni/networkmorphism_tuner/layer_transformer.py | def add_noise(weights, other_weights):
'''add noise to the layer.
'''
w_range = np.ptp(other_weights.flatten())
noise_range = NOISE_RATIO * w_range
noise = np.random.uniform(-noise_range / 2.0, noise_range / 2.0, weights.shape)
return np.add(noise, weights) | def add_noise(weights, other_weights):
'''add noise to the layer.
'''
w_range = np.ptp(other_weights.flatten())
noise_range = NOISE_RATIO * w_range
noise = np.random.uniform(-noise_range / 2.0, noise_range / 2.0, weights.shape)
return np.add(noise, weights) | [
"add",
"noise",
"to",
"the",
"layer",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/layer_transformer.py#L223-L229 | [
"def",
"add_noise",
"(",
"weights",
",",
"other_weights",
")",
":",
"w_range",
"=",
"np",
".",
"ptp",
"(",
"other_weights",
".",
"flatten",
"(",
")",
")",
"noise_range",
"=",
"NOISE_RATIO",
"*",
"w_range",
"noise",
"=",
"np",
".",
"random",
".",
"uniform... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | init_dense_weight | initilize dense layer weight. | src/sdk/pynni/nni/networkmorphism_tuner/layer_transformer.py | def init_dense_weight(layer):
'''initilize dense layer weight.
'''
units = layer.units
weight = np.eye(units)
bias = np.zeros(units)
layer.set_weights(
(add_noise(weight, np.array([0, 1])), add_noise(bias, np.array([0, 1])))
) | def init_dense_weight(layer):
'''initilize dense layer weight.
'''
units = layer.units
weight = np.eye(units)
bias = np.zeros(units)
layer.set_weights(
(add_noise(weight, np.array([0, 1])), add_noise(bias, np.array([0, 1])))
) | [
"initilize",
"dense",
"layer",
"weight",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/layer_transformer.py#L232-L240 | [
"def",
"init_dense_weight",
"(",
"layer",
")",
":",
"units",
"=",
"layer",
".",
"units",
"weight",
"=",
"np",
".",
"eye",
"(",
"units",
")",
"bias",
"=",
"np",
".",
"zeros",
"(",
"units",
")",
"layer",
".",
"set_weights",
"(",
"(",
"add_noise",
"(",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
train | init_conv_weight | initilize conv layer weight. | src/sdk/pynni/nni/networkmorphism_tuner/layer_transformer.py | def init_conv_weight(layer):
'''initilize conv layer weight.
'''
n_filters = layer.filters
filter_shape = (layer.kernel_size,) * get_n_dim(layer)
weight = np.zeros((n_filters, n_filters) + filter_shape)
center = tuple(map(lambda x: int((x - 1) / 2), filter_shape))
for i in range(n_filters):... | def init_conv_weight(layer):
'''initilize conv layer weight.
'''
n_filters = layer.filters
filter_shape = (layer.kernel_size,) * get_n_dim(layer)
weight = np.zeros((n_filters, n_filters) + filter_shape)
center = tuple(map(lambda x: int((x - 1) / 2), filter_shape))
for i in range(n_filters):... | [
"initilize",
"conv",
"layer",
"weight",
"."
] | Microsoft/nni | python | https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/layer_transformer.py#L243-L260 | [
"def",
"init_conv_weight",
"(",
"layer",
")",
":",
"n_filters",
"=",
"layer",
".",
"filters",
"filter_shape",
"=",
"(",
"layer",
".",
"kernel_size",
",",
")",
"*",
"get_n_dim",
"(",
"layer",
")",
"weight",
"=",
"np",
".",
"zeros",
"(",
"(",
"n_filters",
... | c7cc8db32da8d2ec77a382a55089f4e17247ce41 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.