id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
28,700 | apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py | TransformerChain.fit_transform | def fit_transform(self, data):
"""
First fit a transformer using the SFrame `data` and then return a transformed
version of `data`.
Parameters
----------
data : SFrame
The data used to fit the transformer. The same data is then also
transformed.
... | python | def fit_transform(self, data):
"""
First fit a transformer using the SFrame `data` and then return a transformed
version of `data`.
Parameters
----------
data : SFrame
The data used to fit the transformer. The same data is then also
transformed.
... | [
"def",
"fit_transform",
"(",
"self",
",",
"data",
")",
":",
"if",
"not",
"self",
".",
"_transformers",
":",
"return",
"self",
".",
"_preprocess",
"(",
"data",
")",
"transformed_data",
"=",
"self",
".",
"_preprocess",
"(",
"data",
")",
"final_step",
"=",
... | First fit a transformer using the SFrame `data` and then return a transformed
version of `data`.
Parameters
----------
data : SFrame
The data used to fit the transformer. The same data is then also
transformed.
Returns
-------
Transformed... | [
"First",
"fit",
"a",
"transformer",
"using",
"the",
"SFrame",
"data",
"and",
"then",
"return",
"a",
"transformed",
"version",
"of",
"data",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py#L235-L271 |
28,701 | apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py | TransformerChain._load_version | def _load_version(cls, unpickler, version):
"""
An function to load an object with a specific version of the class.
Parameters
----------
pickler : file
A GLUnpickler file handle.
version : int
A version number as maintained by the class writer.
... | python | def _load_version(cls, unpickler, version):
"""
An function to load an object with a specific version of the class.
Parameters
----------
pickler : file
A GLUnpickler file handle.
version : int
A version number as maintained by the class writer.
... | [
"def",
"_load_version",
"(",
"cls",
",",
"unpickler",
",",
"version",
")",
":",
"obj",
"=",
"unpickler",
".",
"load",
"(",
")",
"return",
"TransformerChain",
"(",
"obj",
".",
"_state",
"[",
"\"steps\"",
"]",
")"
] | An function to load an object with a specific version of the class.
Parameters
----------
pickler : file
A GLUnpickler file handle.
version : int
A version number as maintained by the class writer. | [
"An",
"function",
"to",
"load",
"an",
"object",
"with",
"a",
"specific",
"version",
"of",
"the",
"class",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_transformer_chain.py#L348-L361 |
28,702 | apple/turicreate | src/unity/python/turicreate/toolkits/graph_analytics/pagerank.py | create | def create(graph, reset_probability=0.15,
threshold=1e-2,
max_iterations=20,
_single_precision=False,
_distributed='auto',
verbose=True):
"""
Compute the PageRank for each vertex in the graph. Return a model object
with total PageRank as well as the Pag... | python | def create(graph, reset_probability=0.15,
threshold=1e-2,
max_iterations=20,
_single_precision=False,
_distributed='auto',
verbose=True):
"""
Compute the PageRank for each vertex in the graph. Return a model object
with total PageRank as well as the Pag... | [
"def",
"create",
"(",
"graph",
",",
"reset_probability",
"=",
"0.15",
",",
"threshold",
"=",
"1e-2",
",",
"max_iterations",
"=",
"20",
",",
"_single_precision",
"=",
"False",
",",
"_distributed",
"=",
"'auto'",
",",
"verbose",
"=",
"True",
")",
":",
"from"... | Compute the PageRank for each vertex in the graph. Return a model object
with total PageRank as well as the PageRank value for each vertex in the
graph.
Parameters
----------
graph : SGraph
The graph on which to compute the pagerank value.
reset_probability : float, optional
Pr... | [
"Compute",
"the",
"PageRank",
"for",
"each",
"vertex",
"in",
"the",
"graph",
".",
"Return",
"a",
"model",
"object",
"with",
"total",
"PageRank",
"as",
"well",
"as",
"the",
"PageRank",
"value",
"for",
"each",
"vertex",
"in",
"the",
"graph",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/graph_analytics/pagerank.py#L105-L191 |
28,703 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/tools/gcc.py | init_link_flags | def init_link_flags(toolset, linker, condition):
"""
Now, the vendor specific flags.
The parameter linker can be either gnu, darwin, osf, hpux or sun.
"""
toolset_link = toolset + '.link'
if linker == 'gnu':
# Strip the binary when no debugging is needed. We use --strip-all flag
... | python | def init_link_flags(toolset, linker, condition):
"""
Now, the vendor specific flags.
The parameter linker can be either gnu, darwin, osf, hpux or sun.
"""
toolset_link = toolset + '.link'
if linker == 'gnu':
# Strip the binary when no debugging is needed. We use --strip-all flag
... | [
"def",
"init_link_flags",
"(",
"toolset",
",",
"linker",
",",
"condition",
")",
":",
"toolset_link",
"=",
"toolset",
"+",
"'.link'",
"if",
"linker",
"==",
"'gnu'",
":",
"# Strip the binary when no debugging is needed. We use --strip-all flag",
"# as opposed to -s since icc ... | Now, the vendor specific flags.
The parameter linker can be either gnu, darwin, osf, hpux or sun. | [
"Now",
"the",
"vendor",
"specific",
"flags",
".",
"The",
"parameter",
"linker",
"can",
"be",
"either",
"gnu",
"darwin",
"osf",
"hpux",
"or",
"sun",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/gcc.py#L494-L608 |
28,704 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/engine.py | Engine.add_dependency | def add_dependency (self, targets, sources):
"""Adds a dependency from 'targets' to 'sources'
Both 'targets' and 'sources' can be either list
of target names, or a single target name.
"""
if isinstance (targets, str):
targets = [targets]
if isinstance (source... | python | def add_dependency (self, targets, sources):
"""Adds a dependency from 'targets' to 'sources'
Both 'targets' and 'sources' can be either list
of target names, or a single target name.
"""
if isinstance (targets, str):
targets = [targets]
if isinstance (source... | [
"def",
"add_dependency",
"(",
"self",
",",
"targets",
",",
"sources",
")",
":",
"if",
"isinstance",
"(",
"targets",
",",
"str",
")",
":",
"targets",
"=",
"[",
"targets",
"]",
"if",
"isinstance",
"(",
"sources",
",",
"str",
")",
":",
"sources",
"=",
"... | Adds a dependency from 'targets' to 'sources'
Both 'targets' and 'sources' can be either list
of target names, or a single target name. | [
"Adds",
"a",
"dependency",
"from",
"targets",
"to",
"sources"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/engine.py#L76-L91 |
28,705 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/engine.py | Engine.get_target_variable | def get_target_variable(self, targets, variable):
"""Gets the value of `variable` on set on the first target in `targets`.
Args:
targets (str or list): one or more targets to get the variable from.
variable (str): the name of the variable
Returns:
the value... | python | def get_target_variable(self, targets, variable):
"""Gets the value of `variable` on set on the first target in `targets`.
Args:
targets (str or list): one or more targets to get the variable from.
variable (str): the name of the variable
Returns:
the value... | [
"def",
"get_target_variable",
"(",
"self",
",",
"targets",
",",
"variable",
")",
":",
"if",
"isinstance",
"(",
"targets",
",",
"str",
")",
":",
"targets",
"=",
"[",
"targets",
"]",
"assert",
"is_iterable",
"(",
"targets",
")",
"assert",
"isinstance",
"(",
... | Gets the value of `variable` on set on the first target in `targets`.
Args:
targets (str or list): one or more targets to get the variable from.
variable (str): the name of the variable
Returns:
the value of `variable` set on `targets` (list)
Example:
... | [
"Gets",
"the",
"value",
"of",
"variable",
"on",
"set",
"on",
"the",
"first",
"target",
"in",
"targets",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/engine.py#L93-L121 |
28,706 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/engine.py | Engine.set_target_variable | def set_target_variable (self, targets, variable, value, append=0):
""" Sets a target variable.
The 'variable' will be available to bjam when it decides
where to generate targets, and will also be available to
updating rule for that 'taret'.
"""
if isinstance (targets, s... | python | def set_target_variable (self, targets, variable, value, append=0):
""" Sets a target variable.
The 'variable' will be available to bjam when it decides
where to generate targets, and will also be available to
updating rule for that 'taret'.
"""
if isinstance (targets, s... | [
"def",
"set_target_variable",
"(",
"self",
",",
"targets",
",",
"variable",
",",
"value",
",",
"append",
"=",
"0",
")",
":",
"if",
"isinstance",
"(",
"targets",
",",
"str",
")",
":",
"targets",
"=",
"[",
"targets",
"]",
"if",
"isinstance",
"(",
"value"... | Sets a target variable.
The 'variable' will be available to bjam when it decides
where to generate targets, and will also be available to
updating rule for that 'taret'. | [
"Sets",
"a",
"target",
"variable",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/engine.py#L123-L143 |
28,707 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/engine.py | Engine.set_update_action | def set_update_action (self, action_name, targets, sources, properties=None):
""" Binds a target to the corresponding update action.
If target needs to be updated, the action registered
with action_name will be used.
The 'action_name' must be previously registered by
... | python | def set_update_action (self, action_name, targets, sources, properties=None):
""" Binds a target to the corresponding update action.
If target needs to be updated, the action registered
with action_name will be used.
The 'action_name' must be previously registered by
... | [
"def",
"set_update_action",
"(",
"self",
",",
"action_name",
",",
"targets",
",",
"sources",
",",
"properties",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"targets",
",",
"str",
")",
":",
"targets",
"=",
"[",
"targets",
"]",
"if",
"isinstance",
"(",... | Binds a target to the corresponding update action.
If target needs to be updated, the action registered
with action_name will be used.
The 'action_name' must be previously registered by
either 'register_action' or 'register_bjam_action'
method. | [
"Binds",
"a",
"target",
"to",
"the",
"corresponding",
"update",
"action",
".",
"If",
"target",
"needs",
"to",
"be",
"updated",
"the",
"action",
"registered",
"with",
"action_name",
"will",
"be",
"used",
".",
"The",
"action_name",
"must",
"be",
"previously",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/engine.py#L145-L164 |
28,708 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/engine.py | Engine.register_action | def register_action (self, action_name, command='', bound_list = [], flags = [],
function = None):
"""Creates a new build engine action.
Creates on bjam side an action named 'action_name', with
'command' as the command to be executed, 'bound_variables'
naming th... | python | def register_action (self, action_name, command='', bound_list = [], flags = [],
function = None):
"""Creates a new build engine action.
Creates on bjam side an action named 'action_name', with
'command' as the command to be executed, 'bound_variables'
naming th... | [
"def",
"register_action",
"(",
"self",
",",
"action_name",
",",
"command",
"=",
"''",
",",
"bound_list",
"=",
"[",
"]",
",",
"flags",
"=",
"[",
"]",
",",
"function",
"=",
"None",
")",
":",
"assert",
"isinstance",
"(",
"action_name",
",",
"basestring",
... | Creates a new build engine action.
Creates on bjam side an action named 'action_name', with
'command' as the command to be executed, 'bound_variables'
naming the list of variables bound when the command is executed
and specified flag.
If 'function' is not None, it should be a ca... | [
"Creates",
"a",
"new",
"build",
"engine",
"action",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/engine.py#L166-L199 |
28,709 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/engine.py | Engine.register_bjam_action | def register_bjam_action (self, action_name, function=None):
"""Informs self that 'action_name' is declared in bjam.
From this point, 'action_name' is a valid argument to the
set_update_action method. The action_name should be callable
in the global module of bjam.
"""
... | python | def register_bjam_action (self, action_name, function=None):
"""Informs self that 'action_name' is declared in bjam.
From this point, 'action_name' is a valid argument to the
set_update_action method. The action_name should be callable
in the global module of bjam.
"""
... | [
"def",
"register_bjam_action",
"(",
"self",
",",
"action_name",
",",
"function",
"=",
"None",
")",
":",
"# We allow duplicate calls to this rule for the same",
"# action name. This way, jamfile rules that take action names",
"# can just register them without specially checking if",
"#... | Informs self that 'action_name' is declared in bjam.
From this point, 'action_name' is a valid argument to the
set_update_action method. The action_name should be callable
in the global module of bjam. | [
"Informs",
"self",
"that",
"action_name",
"is",
"declared",
"in",
"bjam",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/engine.py#L201-L216 |
28,710 | apple/turicreate | src/unity/python/turicreate/data_structures/image.py | Image.pixel_data | def pixel_data(self):
"""
Returns the pixel data stored in the Image object.
Returns
-------
out : numpy.array
The pixel data of the Image object. It returns a multi-dimensional
numpy array, where the shape of the array represents the shape of
... | python | def pixel_data(self):
"""
Returns the pixel data stored in the Image object.
Returns
-------
out : numpy.array
The pixel data of the Image object. It returns a multi-dimensional
numpy array, where the shape of the array represents the shape of
... | [
"def",
"pixel_data",
"(",
"self",
")",
":",
"from",
".",
".",
"import",
"extensions",
"as",
"_extensions",
"data",
"=",
"_np",
".",
"zeros",
"(",
"(",
"self",
".",
"height",
",",
"self",
".",
"width",
",",
"self",
".",
"channels",
")",
",",
"dtype",
... | Returns the pixel data stored in the Image object.
Returns
-------
out : numpy.array
The pixel data of the Image object. It returns a multi-dimensional
numpy array, where the shape of the array represents the shape of
the image (height, weight, channels).
... | [
"Returns",
"the",
"pixel",
"data",
"stored",
"in",
"the",
"Image",
"object",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/image.py#L141-L167 |
28,711 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/model.py | MLModel.predict | def predict(self, data, useCPUOnly=False, **kwargs):
"""
Return predictions for the model. The kwargs gets passed into the
model as a dictionary.
Parameters
----------
data : dict[str, value]
Dictionary of data to make predictions from where the keys are
... | python | def predict(self, data, useCPUOnly=False, **kwargs):
"""
Return predictions for the model. The kwargs gets passed into the
model as a dictionary.
Parameters
----------
data : dict[str, value]
Dictionary of data to make predictions from where the keys are
... | [
"def",
"predict",
"(",
"self",
",",
"data",
",",
"useCPUOnly",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"__proxy__",
":",
"return",
"self",
".",
"__proxy__",
".",
"predict",
"(",
"data",
",",
"useCPUOnly",
")",
"else",
":",... | Return predictions for the model. The kwargs gets passed into the
model as a dictionary.
Parameters
----------
data : dict[str, value]
Dictionary of data to make predictions from where the keys are
the names of the input features.
useCPUOnly : bool
... | [
"Return",
"predictions",
"for",
"the",
"model",
".",
"The",
"kwargs",
"gets",
"passed",
"into",
"the",
"model",
"as",
"a",
"dictionary",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/model.py#L300-L347 |
28,712 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/model.py | MLModel.visualize_spec | def visualize_spec(self, port=None, input_shape_dict=None):
"""
Visualize the model.
Parameters
----------
port : int
if server is to be hosted on specific localhost port
input_shape_dict : dict
The shapes are calculat... | python | def visualize_spec(self, port=None, input_shape_dict=None):
"""
Visualize the model.
Parameters
----------
port : int
if server is to be hosted on specific localhost port
input_shape_dict : dict
The shapes are calculat... | [
"def",
"visualize_spec",
"(",
"self",
",",
"port",
"=",
"None",
",",
"input_shape_dict",
"=",
"None",
")",
":",
"spec",
"=",
"self",
".",
"_spec",
"model_type",
"=",
"spec",
".",
"WhichOneof",
"(",
"'Type'",
")",
"model_description",
"=",
"spec",
".",
"d... | Visualize the model.
Parameters
----------
port : int
if server is to be hosted on specific localhost port
input_shape_dict : dict
The shapes are calculated assuming the batch and sequence
are 1 i.e. (1, 1, C, H, W). If ei... | [
"Visualize",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/model.py#L349-L478 |
28,713 | apple/turicreate | src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py | _construct_auto_distance | def _construct_auto_distance(feature_names, column_names, column_types, sample):
"""
Construct composite distance parameters based on selected features and their
types.
"""
## Make a dictionary from the column_names and column_types
col_type_dict = {k: v for k, v in zip(column_names, column_typ... | python | def _construct_auto_distance(feature_names, column_names, column_types, sample):
"""
Construct composite distance parameters based on selected features and their
types.
"""
## Make a dictionary from the column_names and column_types
col_type_dict = {k: v for k, v in zip(column_names, column_typ... | [
"def",
"_construct_auto_distance",
"(",
"feature_names",
",",
"column_names",
",",
"column_types",
",",
"sample",
")",
":",
"## Make a dictionary from the column_names and column_types",
"col_type_dict",
"=",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"zip",
"(... | Construct composite distance parameters based on selected features and their
types. | [
"Construct",
"composite",
"distance",
"parameters",
"based",
"on",
"selected",
"features",
"and",
"their",
"types",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py#L33-L71 |
28,714 | apple/turicreate | src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py | NearestNeighborsModel._list_fields | def _list_fields(self):
"""
List the fields stored in the model, including data, model, and
training options. Each field can be queried with the ``get`` method.
Returns
-------
out : list
List of fields queryable with the ``get`` method.
"""
o... | python | def _list_fields(self):
"""
List the fields stored in the model, including data, model, and
training options. Each field can be queried with the ``get`` method.
Returns
-------
out : list
List of fields queryable with the ``get`` method.
"""
o... | [
"def",
"_list_fields",
"(",
"self",
")",
":",
"opts",
"=",
"{",
"'model'",
":",
"self",
".",
"__proxy__",
",",
"'model_name'",
":",
"self",
".",
"__name__",
"}",
"response",
"=",
"_turicreate",
".",
"extensions",
".",
"_nearest_neighbors",
".",
"list_fields"... | List the fields stored in the model, including data, model, and
training options. Each field can be queried with the ``get`` method.
Returns
-------
out : list
List of fields queryable with the ``get`` method. | [
"List",
"the",
"fields",
"stored",
"in",
"the",
"model",
"including",
"data",
"model",
"and",
"training",
"options",
".",
"Each",
"field",
"can",
"be",
"queried",
"with",
"the",
"get",
"method",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py#L675-L688 |
28,715 | apple/turicreate | src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py | NearestNeighborsModel.query | def query(self, dataset, label=None, k=5, radius=None, verbose=True):
"""
For each row of the input 'dataset', retrieve the nearest neighbors
from the model's stored data. In general, the query dataset does not
need to be the same as the reference data stored in the model, but if
... | python | def query(self, dataset, label=None, k=5, radius=None, verbose=True):
"""
For each row of the input 'dataset', retrieve the nearest neighbors
from the model's stored data. In general, the query dataset does not
need to be the same as the reference data stored in the model, but if
... | [
"def",
"query",
"(",
"self",
",",
"dataset",
",",
"label",
"=",
"None",
",",
"k",
"=",
"5",
",",
"radius",
"=",
"None",
",",
"verbose",
"=",
"True",
")",
":",
"## Validate the 'dataset' input",
"_tkutl",
".",
"_raise_error_if_not_sframe",
"(",
"dataset",
"... | For each row of the input 'dataset', retrieve the nearest neighbors
from the model's stored data. In general, the query dataset does not
need to be the same as the reference data stored in the model, but if
it is, the 'include_self_edges' parameter can be set to False to
exclude results ... | [
"For",
"each",
"row",
"of",
"the",
"input",
"dataset",
"retrieve",
"the",
"nearest",
"neighbors",
"from",
"the",
"model",
"s",
"stored",
"data",
".",
"In",
"general",
"the",
"query",
"dataset",
"does",
"not",
"need",
"to",
"be",
"the",
"same",
"as",
"the... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py#L777-L935 |
28,716 | apple/turicreate | src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py | NearestNeighborsModel.similarity_graph | def similarity_graph(self, k=5, radius=None, include_self_edges=False,
output_type='SGraph', verbose=True):
"""
Construct the similarity graph on the reference dataset, which is
already stored in the model. This is conceptually very similar to
running `query` wit... | python | def similarity_graph(self, k=5, radius=None, include_self_edges=False,
output_type='SGraph', verbose=True):
"""
Construct the similarity graph on the reference dataset, which is
already stored in the model. This is conceptually very similar to
running `query` wit... | [
"def",
"similarity_graph",
"(",
"self",
",",
"k",
"=",
"5",
",",
"radius",
"=",
"None",
",",
"include_self_edges",
"=",
"False",
",",
"output_type",
"=",
"'SGraph'",
",",
"verbose",
"=",
"True",
")",
":",
"## Validate inputs.",
"if",
"k",
"is",
"not",
"N... | Construct the similarity graph on the reference dataset, which is
already stored in the model. This is conceptually very similar to
running `query` with the reference set, but this method is optimized
for the purpose, syntactically simpler, and automatically removes
self-edges.
... | [
"Construct",
"the",
"similarity",
"graph",
"on",
"the",
"reference",
"dataset",
"which",
"is",
"already",
"stored",
"in",
"the",
"model",
".",
"This",
"is",
"conceptually",
"very",
"similar",
"to",
"running",
"query",
"with",
"the",
"reference",
"set",
"but",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/nearest_neighbors/_nearest_neighbors.py#L937-L1060 |
28,717 | apple/turicreate | src/unity/python/turicreate/toolkits/activity_classifier/util.py | random_split_by_session | def random_split_by_session(dataset, session_id, fraction=0.9, seed=None):
"""
Randomly split an SFrame into two SFrames based on the `session_id` such
that one split contains data for a `fraction` of the sessions while the
second split contains all data for the rest of the sessions.
Parameters
... | python | def random_split_by_session(dataset, session_id, fraction=0.9, seed=None):
"""
Randomly split an SFrame into two SFrames based on the `session_id` such
that one split contains data for a `fraction` of the sessions while the
second split contains all data for the rest of the sessions.
Parameters
... | [
"def",
"random_split_by_session",
"(",
"dataset",
",",
"session_id",
",",
"fraction",
"=",
"0.9",
",",
"seed",
"=",
"None",
")",
":",
"from",
"random",
"import",
"Random",
"_raise_error_if_not_of_type",
"(",
"dataset",
",",
"_SFrame",
",",
"'dataset'",
")",
"_... | Randomly split an SFrame into two SFrames based on the `session_id` such
that one split contains data for a `fraction` of the sessions while the
second split contains all data for the rest of the sessions.
Parameters
----------
dataset : SFrame
Dataset to split. It must contain a column of ... | [
"Randomly",
"split",
"an",
"SFrame",
"into",
"two",
"SFrames",
"based",
"on",
"the",
"session_id",
"such",
"that",
"one",
"split",
"contains",
"data",
"for",
"a",
"fraction",
"of",
"the",
"sessions",
"while",
"the",
"second",
"split",
"contains",
"all",
"dat... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/activity_classifier/util.py#L20-L104 |
28,718 | apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | read_msbuild_xml | def read_msbuild_xml(path, values={}):
"""Reads the MS Build XML file at the path and returns its contents.
Keyword arguments:
values -- The map to append the contents to (default {})
"""
# Attempt to read the file contents
try:
document = parse(path)
except Exception as e:
... | python | def read_msbuild_xml(path, values={}):
"""Reads the MS Build XML file at the path and returns its contents.
Keyword arguments:
values -- The map to append the contents to (default {})
"""
# Attempt to read the file contents
try:
document = parse(path)
except Exception as e:
... | [
"def",
"read_msbuild_xml",
"(",
"path",
",",
"values",
"=",
"{",
"}",
")",
":",
"# Attempt to read the file contents",
"try",
":",
"document",
"=",
"parse",
"(",
"path",
")",
"except",
"Exception",
"as",
"e",
":",
"logging",
".",
"exception",
"(",
"'Could no... | Reads the MS Build XML file at the path and returns its contents.
Keyword arguments:
values -- The map to append the contents to (default {}) | [
"Reads",
"the",
"MS",
"Build",
"XML",
"file",
"at",
"the",
"path",
"and",
"returns",
"its",
"contents",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L38-L76 |
28,719 | apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | read_msbuild_json | def read_msbuild_json(path, values=[]):
"""Reads the MS Build JSON file at the path and returns its contents.
Keyword arguments:
values -- The list to append the contents to (default [])
"""
if not os.path.exists(path):
logging.info('Could not find MS Build JSON file at %s', path)
r... | python | def read_msbuild_json(path, values=[]):
"""Reads the MS Build JSON file at the path and returns its contents.
Keyword arguments:
values -- The list to append the contents to (default [])
"""
if not os.path.exists(path):
logging.info('Could not find MS Build JSON file at %s', path)
r... | [
"def",
"read_msbuild_json",
"(",
"path",
",",
"values",
"=",
"[",
"]",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"logging",
".",
"info",
"(",
"'Could not find MS Build JSON file at %s'",
",",
"path",
")",
"return",
"... | Reads the MS Build JSON file at the path and returns its contents.
Keyword arguments:
values -- The list to append the contents to (default []) | [
"Reads",
"the",
"MS",
"Build",
"JSON",
"file",
"at",
"the",
"path",
"and",
"returns",
"its",
"contents",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L79-L97 |
28,720 | apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | main | def main():
"""Script entrypoint."""
# Parse the arguments
parser = argparse.ArgumentParser(
description='Convert MSBuild XML to JSON format')
parser.add_argument(
'-t', '--toolchain', help='The name of the toolchain', required=True)
parser.add_argument(
'-o', '--output', he... | python | def main():
"""Script entrypoint."""
# Parse the arguments
parser = argparse.ArgumentParser(
description='Convert MSBuild XML to JSON format')
parser.add_argument(
'-t', '--toolchain', help='The name of the toolchain', required=True)
parser.add_argument(
'-o', '--output', he... | [
"def",
"main",
"(",
")",
":",
"# Parse the arguments",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Convert MSBuild XML to JSON format'",
")",
"parser",
".",
"add_argument",
"(",
"'-t'",
",",
"'--toolchain'",
",",
"help",
"=",
"'The... | Script entrypoint. | [
"Script",
"entrypoint",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L100-L168 |
28,721 | apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __merge_json_values | def __merge_json_values(current, previous):
"""Merges the values between the current and previous run of the script."""
for value in current:
name = value['name']
# Find the previous value
previous_value = __find_and_remove_value(previous, value)
if previous_value is not None:
... | python | def __merge_json_values(current, previous):
"""Merges the values between the current and previous run of the script."""
for value in current:
name = value['name']
# Find the previous value
previous_value = __find_and_remove_value(previous, value)
if previous_value is not None:
... | [
"def",
"__merge_json_values",
"(",
"current",
",",
"previous",
")",
":",
"for",
"value",
"in",
"current",
":",
"name",
"=",
"value",
"[",
"'name'",
"]",
"# Find the previous value",
"previous_value",
"=",
"__find_and_remove_value",
"(",
"previous",
",",
"value",
... | Merges the values between the current and previous run of the script. | [
"Merges",
"the",
"values",
"between",
"the",
"current",
"and",
"previous",
"run",
"of",
"the",
"script",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L173-L198 |
28,722 | apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __find_and_remove_value | def __find_and_remove_value(list, compare):
"""Finds the value in the list that corresponds with the value of compare."""
# next throws if there are no matches
try:
found = next(value for value in list
if value['name'] == compare['name'] and value['switch'] ==
... | python | def __find_and_remove_value(list, compare):
"""Finds the value in the list that corresponds with the value of compare."""
# next throws if there are no matches
try:
found = next(value for value in list
if value['name'] == compare['name'] and value['switch'] ==
... | [
"def",
"__find_and_remove_value",
"(",
"list",
",",
"compare",
")",
":",
"# next throws if there are no matches",
"try",
":",
"found",
"=",
"next",
"(",
"value",
"for",
"value",
"in",
"list",
"if",
"value",
"[",
"'name'",
"]",
"==",
"compare",
"[",
"'name'",
... | Finds the value in the list that corresponds with the value of compare. | [
"Finds",
"the",
"value",
"in",
"the",
"list",
"that",
"corresponds",
"with",
"the",
"value",
"of",
"compare",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L201-L213 |
28,723 | apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __convert | def __convert(root, tag, values, func):
"""Converts the tag type found in the root and converts them using the func
and appends them to the values.
"""
elements = root.getElementsByTagName(tag)
for element in elements:
converted = func(element)
# Append to the list
__append... | python | def __convert(root, tag, values, func):
"""Converts the tag type found in the root and converts them using the func
and appends them to the values.
"""
elements = root.getElementsByTagName(tag)
for element in elements:
converted = func(element)
# Append to the list
__append... | [
"def",
"__convert",
"(",
"root",
",",
"tag",
",",
"values",
",",
"func",
")",
":",
"elements",
"=",
"root",
".",
"getElementsByTagName",
"(",
"tag",
")",
"for",
"element",
"in",
"elements",
":",
"converted",
"=",
"func",
"(",
"element",
")",
"# Append to... | Converts the tag type found in the root and converts them using the func
and appends them to the values. | [
"Converts",
"the",
"tag",
"type",
"found",
"in",
"the",
"root",
"and",
"converts",
"them",
"using",
"the",
"func",
"and",
"appends",
"them",
"to",
"the",
"values",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L218-L228 |
28,724 | apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __convert_enum | def __convert_enum(node):
"""Converts an EnumProperty node to JSON format."""
name = __get_attribute(node, 'Name')
logging.debug('Found EnumProperty named %s', name)
converted_values = []
for value in node.getElementsByTagName('EnumValue'):
converted = __convert_node(value)
conver... | python | def __convert_enum(node):
"""Converts an EnumProperty node to JSON format."""
name = __get_attribute(node, 'Name')
logging.debug('Found EnumProperty named %s', name)
converted_values = []
for value in node.getElementsByTagName('EnumValue'):
converted = __convert_node(value)
conver... | [
"def",
"__convert_enum",
"(",
"node",
")",
":",
"name",
"=",
"__get_attribute",
"(",
"node",
",",
"'Name'",
")",
"logging",
".",
"debug",
"(",
"'Found EnumProperty named %s'",
",",
"name",
")",
"converted_values",
"=",
"[",
"]",
"for",
"value",
"in",
"node",... | Converts an EnumProperty node to JSON format. | [
"Converts",
"an",
"EnumProperty",
"node",
"to",
"JSON",
"format",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L231-L249 |
28,725 | apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __convert_bool | def __convert_bool(node):
"""Converts an BoolProperty node to JSON format."""
converted = __convert_node(node, default_value='true')
# Check for a switch for reversing the value
reverse_switch = __get_attribute(node, 'ReverseSwitch')
if reverse_switch:
converted_reverse = copy.deepcopy(con... | python | def __convert_bool(node):
"""Converts an BoolProperty node to JSON format."""
converted = __convert_node(node, default_value='true')
# Check for a switch for reversing the value
reverse_switch = __get_attribute(node, 'ReverseSwitch')
if reverse_switch:
converted_reverse = copy.deepcopy(con... | [
"def",
"__convert_bool",
"(",
"node",
")",
":",
"converted",
"=",
"__convert_node",
"(",
"node",
",",
"default_value",
"=",
"'true'",
")",
"# Check for a switch for reversing the value",
"reverse_switch",
"=",
"__get_attribute",
"(",
"node",
",",
"'ReverseSwitch'",
")... | Converts an BoolProperty node to JSON format. | [
"Converts",
"an",
"BoolProperty",
"node",
"to",
"JSON",
"format",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L252-L270 |
28,726 | apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __convert_string_list | def __convert_string_list(node):
"""Converts a StringListProperty node to JSON format."""
converted = __convert_node(node)
# Determine flags for the string list
flags = vsflags(VSFlags.UserValue)
# Check for a separator to determine if it is semicolon appendable
# If not present assume the val... | python | def __convert_string_list(node):
"""Converts a StringListProperty node to JSON format."""
converted = __convert_node(node)
# Determine flags for the string list
flags = vsflags(VSFlags.UserValue)
# Check for a separator to determine if it is semicolon appendable
# If not present assume the val... | [
"def",
"__convert_string_list",
"(",
"node",
")",
":",
"converted",
"=",
"__convert_node",
"(",
"node",
")",
"# Determine flags for the string list",
"flags",
"=",
"vsflags",
"(",
"VSFlags",
".",
"UserValue",
")",
"# Check for a separator to determine if it is semicolon app... | Converts a StringListProperty node to JSON format. | [
"Converts",
"a",
"StringListProperty",
"node",
"to",
"JSON",
"format",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L273-L289 |
28,727 | apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __convert_string | def __convert_string(node):
"""Converts a StringProperty node to JSON format."""
converted = __convert_node(node, default_flags=vsflags(VSFlags.UserValue))
return __check_for_flag(converted) | python | def __convert_string(node):
"""Converts a StringProperty node to JSON format."""
converted = __convert_node(node, default_flags=vsflags(VSFlags.UserValue))
return __check_for_flag(converted) | [
"def",
"__convert_string",
"(",
"node",
")",
":",
"converted",
"=",
"__convert_node",
"(",
"node",
",",
"default_flags",
"=",
"vsflags",
"(",
"VSFlags",
".",
"UserValue",
")",
")",
"return",
"__check_for_flag",
"(",
"converted",
")"
] | Converts a StringProperty node to JSON format. | [
"Converts",
"a",
"StringProperty",
"node",
"to",
"JSON",
"format",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L292-L296 |
28,728 | apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __convert_node | def __convert_node(node, default_value='', default_flags=vsflags()):
"""Converts a XML node to a JSON equivalent."""
name = __get_attribute(node, 'Name')
logging.debug('Found %s named %s', node.tagName, name)
converted = {}
converted['name'] = name
converted['switch'] = __get_attribute(node, 'S... | python | def __convert_node(node, default_value='', default_flags=vsflags()):
"""Converts a XML node to a JSON equivalent."""
name = __get_attribute(node, 'Name')
logging.debug('Found %s named %s', node.tagName, name)
converted = {}
converted['name'] = name
converted['switch'] = __get_attribute(node, 'S... | [
"def",
"__convert_node",
"(",
"node",
",",
"default_value",
"=",
"''",
",",
"default_flags",
"=",
"vsflags",
"(",
")",
")",
":",
"name",
"=",
"__get_attribute",
"(",
"node",
",",
"'Name'",
")",
"logging",
".",
"debug",
"(",
"'Found %s named %s'",
",",
"nod... | Converts a XML node to a JSON equivalent. | [
"Converts",
"a",
"XML",
"node",
"to",
"a",
"JSON",
"equivalent",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L299-L320 |
28,729 | apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __with_argument | def __with_argument(node, value):
"""Modifies the flags in value if the node contains an Argument."""
arguments = node.getElementsByTagName('Argument')
if arguments:
logging.debug('Found argument within %s', value['name'])
value['flags'] = vsflags(VSFlags.UserValueIgnored, VSFlags.Continue) | python | def __with_argument(node, value):
"""Modifies the flags in value if the node contains an Argument."""
arguments = node.getElementsByTagName('Argument')
if arguments:
logging.debug('Found argument within %s', value['name'])
value['flags'] = vsflags(VSFlags.UserValueIgnored, VSFlags.Continue) | [
"def",
"__with_argument",
"(",
"node",
",",
"value",
")",
":",
"arguments",
"=",
"node",
".",
"getElementsByTagName",
"(",
"'Argument'",
")",
"if",
"arguments",
":",
"logging",
".",
"debug",
"(",
"'Found argument within %s'",
",",
"value",
"[",
"'name'",
"]",
... | Modifies the flags in value if the node contains an Argument. | [
"Modifies",
"the",
"flags",
"in",
"value",
"if",
"the",
"node",
"contains",
"an",
"Argument",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L336-L342 |
28,730 | apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __preprocess_arguments | def __preprocess_arguments(root):
"""Preprocesses occurrences of Argument within the root.
Argument XML values reference other values within the document by name. The
referenced value does not contain a switch. This function will add the
switch associated with the argument.
"""
# Set the flags ... | python | def __preprocess_arguments(root):
"""Preprocesses occurrences of Argument within the root.
Argument XML values reference other values within the document by name. The
referenced value does not contain a switch. This function will add the
switch associated with the argument.
"""
# Set the flags ... | [
"def",
"__preprocess_arguments",
"(",
"root",
")",
":",
"# Set the flags to require a value",
"flags",
"=",
"','",
".",
"join",
"(",
"vsflags",
"(",
"VSFlags",
".",
"UserValueRequired",
")",
")",
"# Search through the arguments",
"arguments",
"=",
"root",
".",
"getE... | Preprocesses occurrences of Argument within the root.
Argument XML values reference other values within the document by name. The
referenced value does not contain a switch. This function will add the
switch associated with the argument. | [
"Preprocesses",
"occurrences",
"of",
"Argument",
"within",
"the",
"root",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L345-L387 |
28,731 | apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __get_attribute | def __get_attribute(node, name, default_value=''):
"""Retrieves the attribute of the given name from the node.
If not present then the default_value is used.
"""
if node.hasAttribute(name):
return node.attributes[name].value.strip()
else:
return default_value | python | def __get_attribute(node, name, default_value=''):
"""Retrieves the attribute of the given name from the node.
If not present then the default_value is used.
"""
if node.hasAttribute(name):
return node.attributes[name].value.strip()
else:
return default_value | [
"def",
"__get_attribute",
"(",
"node",
",",
"name",
",",
"default_value",
"=",
"''",
")",
":",
"if",
"node",
".",
"hasAttribute",
"(",
"name",
")",
":",
"return",
"node",
".",
"attributes",
"[",
"name",
"]",
".",
"value",
".",
"strip",
"(",
")",
"els... | Retrieves the attribute of the given name from the node.
If not present then the default_value is used. | [
"Retrieves",
"the",
"attribute",
"of",
"the",
"given",
"name",
"from",
"the",
"node",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L390-L398 |
28,732 | apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __get_path | def __get_path(path):
"""Gets the path to the file."""
if not os.path.isabs(path):
path = os.path.join(os.getcwd(), path)
return os.path.normpath(path) | python | def __get_path(path):
"""Gets the path to the file."""
if not os.path.isabs(path):
path = os.path.join(os.getcwd(), path)
return os.path.normpath(path) | [
"def",
"__get_path",
"(",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"getcwd",
"(",
")",
",",
"path",
")",
"return",
"os",
".",
"path",
"... | Gets the path to the file. | [
"Gets",
"the",
"path",
"to",
"the",
"file",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L403-L408 |
28,733 | apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __output_path | def __output_path(toolchain, rule, output_dir):
"""Gets the output path for a file given the toolchain, rule and output_dir"""
filename = '%s_%s.json' % (toolchain, rule)
return os.path.join(output_dir, filename) | python | def __output_path(toolchain, rule, output_dir):
"""Gets the output path for a file given the toolchain, rule and output_dir"""
filename = '%s_%s.json' % (toolchain, rule)
return os.path.join(output_dir, filename) | [
"def",
"__output_path",
"(",
"toolchain",
",",
"rule",
",",
"output_dir",
")",
":",
"filename",
"=",
"'%s_%s.json'",
"%",
"(",
"toolchain",
",",
"rule",
")",
"return",
"os",
".",
"path",
".",
"join",
"(",
"output_dir",
",",
"filename",
")"
] | Gets the output path for a file given the toolchain, rule and output_dir | [
"Gets",
"the",
"output",
"path",
"for",
"a",
"file",
"given",
"the",
"toolchain",
"rule",
"and",
"output_dir"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L411-L414 |
28,734 | apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __write_json_file | def __write_json_file(path, values):
"""Writes a JSON file at the path with the values provided."""
# Sort the keys to ensure ordering
sort_order = ['name', 'switch', 'comment', 'value', 'flags']
sorted_values = [
OrderedDict(
sorted(
value.items(), key=lambda value: ... | python | def __write_json_file(path, values):
"""Writes a JSON file at the path with the values provided."""
# Sort the keys to ensure ordering
sort_order = ['name', 'switch', 'comment', 'value', 'flags']
sorted_values = [
OrderedDict(
sorted(
value.items(), key=lambda value: ... | [
"def",
"__write_json_file",
"(",
"path",
",",
"values",
")",
":",
"# Sort the keys to ensure ordering",
"sort_order",
"=",
"[",
"'name'",
",",
"'switch'",
",",
"'comment'",
",",
"'value'",
",",
"'flags'",
"]",
"sorted_values",
"=",
"[",
"OrderedDict",
"(",
"sort... | Writes a JSON file at the path with the values provided. | [
"Writes",
"a",
"JSON",
"file",
"at",
"the",
"path",
"with",
"the",
"values",
"provided",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L425-L437 |
28,735 | apple/turicreate | deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py | __append_list | def __append_list(append_to, value):
"""Appends the value to the list."""
if value is not None:
if isinstance(value, list):
append_to.extend(value)
else:
append_to.append(value) | python | def __append_list(append_to, value):
"""Appends the value to the list."""
if value is not None:
if isinstance(value, list):
append_to.extend(value)
else:
append_to.append(value) | [
"def",
"__append_list",
"(",
"append_to",
",",
"value",
")",
":",
"if",
"value",
"is",
"not",
"None",
":",
"if",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"append_to",
".",
"extend",
"(",
"value",
")",
"else",
":",
"append_to",
".",
"append",
... | Appends the value to the list. | [
"Appends",
"the",
"value",
"to",
"the",
"list",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/cmake-3.13.4/Source/cmConvertMSBuildXMLToJSON.py#L442-L448 |
28,736 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py | MacroCollection.ParseInput | def ParseInput(self, a_file):
"""Consumes input extracting definitions.
Args:
a_file: The file like stream to parse.
Raises:
PDDMError if there are any issues.
"""
input_lines = a_file.read().splitlines()
self.ParseLines(input_lines) | python | def ParseInput(self, a_file):
"""Consumes input extracting definitions.
Args:
a_file: The file like stream to parse.
Raises:
PDDMError if there are any issues.
"""
input_lines = a_file.read().splitlines()
self.ParseLines(input_lines) | [
"def",
"ParseInput",
"(",
"self",
",",
"a_file",
")",
":",
"input_lines",
"=",
"a_file",
".",
"read",
"(",
")",
".",
"splitlines",
"(",
")",
"self",
".",
"ParseLines",
"(",
"input_lines",
")"
] | Consumes input extracting definitions.
Args:
a_file: The file like stream to parse.
Raises:
PDDMError if there are any issues. | [
"Consumes",
"input",
"extracting",
"definitions",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py#L182-L192 |
28,737 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py | MacroCollection.ParseLines | def ParseLines(self, input_lines):
"""Parses list of lines.
Args:
input_lines: A list of strings of input to parse (no newlines on the
strings).
Raises:
PDDMError if there are any issues.
"""
current_macro = None
for line in input_lines:
if line.startswith(... | python | def ParseLines(self, input_lines):
"""Parses list of lines.
Args:
input_lines: A list of strings of input to parse (no newlines on the
strings).
Raises:
PDDMError if there are any issues.
"""
current_macro = None
for line in input_lines:
if line.startswith(... | [
"def",
"ParseLines",
"(",
"self",
",",
"input_lines",
")",
":",
"current_macro",
"=",
"None",
"for",
"line",
"in",
"input_lines",
":",
"if",
"line",
".",
"startswith",
"(",
"'PDDM-'",
")",
":",
"directive",
"=",
"line",
".",
"split",
"(",
"' '",
",",
"... | Parses list of lines.
Args:
input_lines: A list of strings of input to parse (no newlines on the
strings).
Raises:
PDDMError if there are any issues. | [
"Parses",
"list",
"of",
"lines",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py#L194-L232 |
28,738 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py | MacroCollection.Expand | def Expand(self, macro_ref_str):
"""Expands the macro reference.
Args:
macro_ref_str: String of a macro reference (i.e. foo(a, b)).
Returns:
The text from the expansion.
Raises:
PDDMError if there are any issues.
"""
match = _MACRO_RE.match(macro_ref_str)
if match is Non... | python | def Expand(self, macro_ref_str):
"""Expands the macro reference.
Args:
macro_ref_str: String of a macro reference (i.e. foo(a, b)).
Returns:
The text from the expansion.
Raises:
PDDMError if there are any issues.
"""
match = _MACRO_RE.match(macro_ref_str)
if match is Non... | [
"def",
"Expand",
"(",
"self",
",",
"macro_ref_str",
")",
":",
"match",
"=",
"_MACRO_RE",
".",
"match",
"(",
"macro_ref_str",
")",
"if",
"match",
"is",
"None",
"or",
"match",
".",
"group",
"(",
"0",
")",
"!=",
"macro_ref_str",
":",
"raise",
"PDDMError",
... | Expands the macro reference.
Args:
macro_ref_str: String of a macro reference (i.e. foo(a, b)).
Returns:
The text from the expansion.
Raises:
PDDMError if there are any issues. | [
"Expands",
"the",
"macro",
"reference",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py#L259-L276 |
28,739 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py | SourceFile.ProcessContent | def ProcessContent(self, strip_expansion=False):
"""Processes the file contents."""
self._ParseFile()
if strip_expansion:
# Without a collection the expansions become blank, removing them.
collection = None
else:
collection = MacroCollection()
for section in self._sections:
s... | python | def ProcessContent(self, strip_expansion=False):
"""Processes the file contents."""
self._ParseFile()
if strip_expansion:
# Without a collection the expansions become blank, removing them.
collection = None
else:
collection = MacroCollection()
for section in self._sections:
s... | [
"def",
"ProcessContent",
"(",
"self",
",",
"strip_expansion",
"=",
"False",
")",
":",
"self",
".",
"_ParseFile",
"(",
")",
"if",
"strip_expansion",
":",
"# Without a collection the expansions become blank, removing them.",
"collection",
"=",
"None",
"else",
":",
"coll... | Processes the file contents. | [
"Processes",
"the",
"file",
"contents",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/objectivec/DevTools/pddm.py#L601-L614 |
28,740 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | defaults | def defaults(features):
""" Returns the default property values for the given features.
"""
assert is_iterable_typed(features, Feature)
# FIXME: should merge feature and property modules.
from . import property
result = []
for f in features:
if not f.free and not f.optional and f.de... | python | def defaults(features):
""" Returns the default property values for the given features.
"""
assert is_iterable_typed(features, Feature)
# FIXME: should merge feature and property modules.
from . import property
result = []
for f in features:
if not f.free and not f.optional and f.de... | [
"def",
"defaults",
"(",
"features",
")",
":",
"assert",
"is_iterable_typed",
"(",
"features",
",",
"Feature",
")",
"# FIXME: should merge feature and property modules.",
"from",
".",
"import",
"property",
"result",
"=",
"[",
"]",
"for",
"f",
"in",
"features",
":",... | Returns the default property values for the given features. | [
"Returns",
"the",
"default",
"property",
"values",
"for",
"the",
"given",
"features",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L186-L198 |
28,741 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | valid | def valid (names):
""" Returns true iff all elements of names are valid features.
"""
if isinstance(names, str):
names = [names]
assert is_iterable_typed(names, basestring)
return all(name in __all_features for name in names) | python | def valid (names):
""" Returns true iff all elements of names are valid features.
"""
if isinstance(names, str):
names = [names]
assert is_iterable_typed(names, basestring)
return all(name in __all_features for name in names) | [
"def",
"valid",
"(",
"names",
")",
":",
"if",
"isinstance",
"(",
"names",
",",
"str",
")",
":",
"names",
"=",
"[",
"names",
"]",
"assert",
"is_iterable_typed",
"(",
"names",
",",
"basestring",
")",
"return",
"all",
"(",
"name",
"in",
"__all_features",
... | Returns true iff all elements of names are valid features. | [
"Returns",
"true",
"iff",
"all",
"elements",
"of",
"names",
"are",
"valid",
"features",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L200-L207 |
28,742 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | values | def values (feature):
""" Return the values of the given feature.
"""
assert isinstance(feature, basestring)
validate_feature (feature)
return __all_features[feature].values | python | def values (feature):
""" Return the values of the given feature.
"""
assert isinstance(feature, basestring)
validate_feature (feature)
return __all_features[feature].values | [
"def",
"values",
"(",
"feature",
")",
":",
"assert",
"isinstance",
"(",
"feature",
",",
"basestring",
")",
"validate_feature",
"(",
"feature",
")",
"return",
"__all_features",
"[",
"feature",
"]",
".",
"values"
] | Return the values of the given feature. | [
"Return",
"the",
"values",
"of",
"the",
"given",
"feature",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L215-L220 |
28,743 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | is_implicit_value | def is_implicit_value (value_string):
""" Returns true iff 'value_string' is a value_string
of an implicit feature.
"""
assert isinstance(value_string, basestring)
if value_string in __implicit_features:
return __implicit_features[value_string]
v = value_string.split('-')
if v[0] n... | python | def is_implicit_value (value_string):
""" Returns true iff 'value_string' is a value_string
of an implicit feature.
"""
assert isinstance(value_string, basestring)
if value_string in __implicit_features:
return __implicit_features[value_string]
v = value_string.split('-')
if v[0] n... | [
"def",
"is_implicit_value",
"(",
"value_string",
")",
":",
"assert",
"isinstance",
"(",
"value_string",
",",
"basestring",
")",
"if",
"value_string",
"in",
"__implicit_features",
":",
"return",
"__implicit_features",
"[",
"value_string",
"]",
"v",
"=",
"value_string... | Returns true iff 'value_string' is a value_string
of an implicit feature. | [
"Returns",
"true",
"iff",
"value_string",
"is",
"a",
"value_string",
"of",
"an",
"implicit",
"feature",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L222-L241 |
28,744 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | implied_feature | def implied_feature (implicit_value):
""" Returns the implicit feature associated with the given implicit value.
"""
assert isinstance(implicit_value, basestring)
components = implicit_value.split('-')
if components[0] not in __implicit_features:
raise InvalidValue ("'%s' is not a value of ... | python | def implied_feature (implicit_value):
""" Returns the implicit feature associated with the given implicit value.
"""
assert isinstance(implicit_value, basestring)
components = implicit_value.split('-')
if components[0] not in __implicit_features:
raise InvalidValue ("'%s' is not a value of ... | [
"def",
"implied_feature",
"(",
"implicit_value",
")",
":",
"assert",
"isinstance",
"(",
"implicit_value",
",",
"basestring",
")",
"components",
"=",
"implicit_value",
".",
"split",
"(",
"'-'",
")",
"if",
"components",
"[",
"0",
"]",
"not",
"in",
"__implicit_fe... | Returns the implicit feature associated with the given implicit value. | [
"Returns",
"the",
"implicit",
"feature",
"associated",
"with",
"the",
"given",
"implicit",
"value",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L243-L252 |
28,745 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | validate_feature | def validate_feature (name):
""" Checks if all name is a valid feature. Otherwise, raises an exception.
"""
assert isinstance(name, basestring)
if name not in __all_features:
raise InvalidFeature ("'%s' is not a valid feature name" % name)
else:
return __all_features[name] | python | def validate_feature (name):
""" Checks if all name is a valid feature. Otherwise, raises an exception.
"""
assert isinstance(name, basestring)
if name not in __all_features:
raise InvalidFeature ("'%s' is not a valid feature name" % name)
else:
return __all_features[name] | [
"def",
"validate_feature",
"(",
"name",
")",
":",
"assert",
"isinstance",
"(",
"name",
",",
"basestring",
")",
"if",
"name",
"not",
"in",
"__all_features",
":",
"raise",
"InvalidFeature",
"(",
"\"'%s' is not a valid feature name\"",
"%",
"name",
")",
"else",
":"... | Checks if all name is a valid feature. Otherwise, raises an exception. | [
"Checks",
"if",
"all",
"name",
"is",
"a",
"valid",
"feature",
".",
"Otherwise",
"raises",
"an",
"exception",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L281-L288 |
28,746 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | expand_subfeatures | def expand_subfeatures(properties, dont_validate = False):
"""
Make all elements of properties corresponding to implicit features
explicit, and express all subfeature values as separate properties
in their own right. For example, the property
gcc-2.95.2-linux-x86
might expand to
<too... | python | def expand_subfeatures(properties, dont_validate = False):
"""
Make all elements of properties corresponding to implicit features
explicit, and express all subfeature values as separate properties
in their own right. For example, the property
gcc-2.95.2-linux-x86
might expand to
<too... | [
"def",
"expand_subfeatures",
"(",
"properties",
",",
"dont_validate",
"=",
"False",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"assert",
"isinstance",
"... | Make all elements of properties corresponding to implicit features
explicit, and express all subfeature values as separate properties
in their own right. For example, the property
gcc-2.95.2-linux-x86
might expand to
<toolset>gcc <toolset-version>2.95.2 <toolset-os>linux <toolset-cpu>x86
... | [
"Make",
"all",
"elements",
"of",
"properties",
"corresponding",
"to",
"implicit",
"features",
"explicit",
"and",
"express",
"all",
"subfeature",
"values",
"as",
"separate",
"properties",
"in",
"their",
"own",
"right",
".",
"For",
"example",
"the",
"property"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L338-L367 |
28,747 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | extend | def extend (name, values):
""" Adds the given values to the given feature.
"""
assert isinstance(name, basestring)
assert is_iterable_typed(values, basestring)
name = add_grist (name)
__validate_feature (name)
feature = __all_features [name]
if feature.implicit:
for v in values:... | python | def extend (name, values):
""" Adds the given values to the given feature.
"""
assert isinstance(name, basestring)
assert is_iterable_typed(values, basestring)
name = add_grist (name)
__validate_feature (name)
feature = __all_features [name]
if feature.implicit:
for v in values:... | [
"def",
"extend",
"(",
"name",
",",
"values",
")",
":",
"assert",
"isinstance",
"(",
"name",
",",
"basestring",
")",
"assert",
"is_iterable_typed",
"(",
"values",
",",
"basestring",
")",
"name",
"=",
"add_grist",
"(",
"name",
")",
"__validate_feature",
"(",
... | Adds the given values to the given feature. | [
"Adds",
"the",
"given",
"values",
"to",
"the",
"given",
"feature",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L389-L410 |
28,748 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | validate_value_string | def validate_value_string (f, value_string):
""" Checks that value-string is a valid value-string for the given feature.
"""
assert isinstance(f, Feature)
assert isinstance(value_string, basestring)
if f.free or value_string in f.values:
return
values = [value_string]
if f.subfeatu... | python | def validate_value_string (f, value_string):
""" Checks that value-string is a valid value-string for the given feature.
"""
assert isinstance(f, Feature)
assert isinstance(value_string, basestring)
if f.free or value_string in f.values:
return
values = [value_string]
if f.subfeatu... | [
"def",
"validate_value_string",
"(",
"f",
",",
"value_string",
")",
":",
"assert",
"isinstance",
"(",
"f",
",",
"Feature",
")",
"assert",
"isinstance",
"(",
"value_string",
",",
"basestring",
")",
"if",
"f",
".",
"free",
"or",
"value_string",
"in",
"f",
".... | Checks that value-string is a valid value-string for the given feature. | [
"Checks",
"that",
"value",
"-",
"string",
"is",
"a",
"valid",
"value",
"-",
"string",
"for",
"the",
"given",
"feature",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L412-L434 |
28,749 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | compose | def compose (composite_property_s, component_properties_s):
""" Sets the components of the given composite property.
All parameters are <feature>value strings
"""
from . import property
component_properties_s = to_seq (component_properties_s)
composite_property = property.create_from_string(co... | python | def compose (composite_property_s, component_properties_s):
""" Sets the components of the given composite property.
All parameters are <feature>value strings
"""
from . import property
component_properties_s = to_seq (component_properties_s)
composite_property = property.create_from_string(co... | [
"def",
"compose",
"(",
"composite_property_s",
",",
"component_properties_s",
")",
":",
"from",
".",
"import",
"property",
"component_properties_s",
"=",
"to_seq",
"(",
"component_properties_s",
")",
"composite_property",
"=",
"property",
".",
"create_from_string",
"(",... | Sets the components of the given composite property.
All parameters are <feature>value strings | [
"Sets",
"the",
"components",
"of",
"the",
"given",
"composite",
"property",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L513-L538 |
28,750 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | get_values | def get_values (feature, properties):
""" Returns all values of the given feature specified by the given property set.
"""
if feature[0] != '<':
feature = '<' + feature + '>'
result = []
for p in properties:
if get_grist (p) == feature:
result.append (replace_grist (p, ''))
... | python | def get_values (feature, properties):
""" Returns all values of the given feature specified by the given property set.
"""
if feature[0] != '<':
feature = '<' + feature + '>'
result = []
for p in properties:
if get_grist (p) == feature:
result.append (replace_grist (p, ''))
... | [
"def",
"get_values",
"(",
"feature",
",",
"properties",
")",
":",
"if",
"feature",
"[",
"0",
"]",
"!=",
"'<'",
":",
"feature",
"=",
"'<'",
"+",
"feature",
"+",
"'>'",
"result",
"=",
"[",
"]",
"for",
"p",
"in",
"properties",
":",
"if",
"get_grist",
... | Returns all values of the given feature specified by the given property set. | [
"Returns",
"all",
"values",
"of",
"the",
"given",
"feature",
"specified",
"by",
"the",
"given",
"property",
"set",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L552-L562 |
28,751 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | expand_composites | def expand_composites (properties):
""" Expand all composite properties in the set so that all components
are explicitly expressed.
"""
if __debug__:
from .property import Property
assert is_iterable_typed(properties, Property)
explicit_features = set(p.feature for p in propertie... | python | def expand_composites (properties):
""" Expand all composite properties in the set so that all components
are explicitly expressed.
"""
if __debug__:
from .property import Property
assert is_iterable_typed(properties, Property)
explicit_features = set(p.feature for p in propertie... | [
"def",
"expand_composites",
"(",
"properties",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"explicit_features",
"=",
"set",
"(",
"p",
".",
"feature",
"... | Expand all composite properties in the set so that all components
are explicitly expressed. | [
"Expand",
"all",
"composite",
"properties",
"in",
"the",
"set",
"so",
"that",
"all",
"components",
"are",
"explicitly",
"expressed",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L569-L606 |
28,752 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | is_subfeature_of | def is_subfeature_of (parent_property, f):
""" Return true iff f is an ordinary subfeature of the parent_property's
feature, or if f is a subfeature of the parent_property's feature
specific to the parent_property's value.
"""
if __debug__:
from .property import Property
asse... | python | def is_subfeature_of (parent_property, f):
""" Return true iff f is an ordinary subfeature of the parent_property's
feature, or if f is a subfeature of the parent_property's feature
specific to the parent_property's value.
"""
if __debug__:
from .property import Property
asse... | [
"def",
"is_subfeature_of",
"(",
"parent_property",
",",
"f",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"isinstance",
"(",
"parent_property",
",",
"Property",
")",
"assert",
"isinstance",
"(",
"f",
",",
"Feature"... | Return true iff f is an ordinary subfeature of the parent_property's
feature, or if f is a subfeature of the parent_property's feature
specific to the parent_property's value. | [
"Return",
"true",
"iff",
"f",
"is",
"an",
"ordinary",
"subfeature",
"of",
"the",
"parent_property",
"s",
"feature",
"or",
"if",
"f",
"is",
"a",
"subfeature",
"of",
"the",
"parent_property",
"s",
"feature",
"specific",
"to",
"the",
"parent_property",
"s",
"va... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L609-L635 |
28,753 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | __is_subproperty_of | def __is_subproperty_of (parent_property, p):
""" As is_subfeature_of, for subproperties.
"""
if __debug__:
from .property import Property
assert isinstance(parent_property, Property)
assert isinstance(p, Property)
return is_subfeature_of (parent_property, p.feature) | python | def __is_subproperty_of (parent_property, p):
""" As is_subfeature_of, for subproperties.
"""
if __debug__:
from .property import Property
assert isinstance(parent_property, Property)
assert isinstance(p, Property)
return is_subfeature_of (parent_property, p.feature) | [
"def",
"__is_subproperty_of",
"(",
"parent_property",
",",
"p",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"isinstance",
"(",
"parent_property",
",",
"Property",
")",
"assert",
"isinstance",
"(",
"p",
",",
"Prope... | As is_subfeature_of, for subproperties. | [
"As",
"is_subfeature_of",
"for",
"subproperties",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L637-L644 |
28,754 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | expand | def expand (properties):
""" Given a property set which may consist of composite and implicit
properties and combined subfeature values, returns an expanded,
normalized property set with all implicit features expressed
explicitly, all subfeature values individually expressed, and all
... | python | def expand (properties):
""" Given a property set which may consist of composite and implicit
properties and combined subfeature values, returns an expanded,
normalized property set with all implicit features expressed
explicitly, all subfeature values individually expressed, and all
... | [
"def",
"expand",
"(",
"properties",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"expanded",
"=",
"expand_subfeatures",
"(",
"properties",
")",
"return",
... | Given a property set which may consist of composite and implicit
properties and combined subfeature values, returns an expanded,
normalized property set with all implicit features expressed
explicitly, all subfeature values individually expressed, and all
components of composite properti... | [
"Given",
"a",
"property",
"set",
"which",
"may",
"consist",
"of",
"composite",
"and",
"implicit",
"properties",
"and",
"combined",
"subfeature",
"values",
"returns",
"an",
"expanded",
"normalized",
"property",
"set",
"with",
"all",
"implicit",
"features",
"express... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L664-L679 |
28,755 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | compress_subproperties | def compress_subproperties (properties):
""" Combine all subproperties into their parent properties
Requires: for every subproperty, there is a parent property. All
features are explicitly expressed.
This rule probably shouldn't be needed, but
build-request.expand-no-defaults is b... | python | def compress_subproperties (properties):
""" Combine all subproperties into their parent properties
Requires: for every subproperty, there is a parent property. All
features are explicitly expressed.
This rule probably shouldn't be needed, but
build-request.expand-no-defaults is b... | [
"def",
"compress_subproperties",
"(",
"properties",
")",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"result",
"=",
"[",
"]",
"matched_subs",
"=",
"set",
"(",
")",
"all_subs",
"=",... | Combine all subproperties into their parent properties
Requires: for every subproperty, there is a parent property. All
features are explicitly expressed.
This rule probably shouldn't be needed, but
build-request.expand-no-defaults is being abused for unintended
purposes and i... | [
"Combine",
"all",
"subproperties",
"into",
"their",
"parent",
"properties"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L819-L856 |
28,756 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | __select_subfeatures | def __select_subfeatures (parent_property, features):
""" Given a property, return the subset of features consisting of all
ordinary subfeatures of the property's feature, and all specific
subfeatures of the property's feature which are conditional on the
property's value.
"""
if __d... | python | def __select_subfeatures (parent_property, features):
""" Given a property, return the subset of features consisting of all
ordinary subfeatures of the property's feature, and all specific
subfeatures of the property's feature which are conditional on the
property's value.
"""
if __d... | [
"def",
"__select_subfeatures",
"(",
"parent_property",
",",
"features",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"isinstance",
"(",
"parent_property",
",",
"Property",
")",
"assert",
"is_iterable_typed",
"(",
"feat... | Given a property, return the subset of features consisting of all
ordinary subfeatures of the property's feature, and all specific
subfeatures of the property's feature which are conditional on the
property's value. | [
"Given",
"a",
"property",
"return",
"the",
"subset",
"of",
"features",
"consisting",
"of",
"all",
"ordinary",
"subfeatures",
"of",
"the",
"property",
"s",
"feature",
"and",
"all",
"specific",
"subfeatures",
"of",
"the",
"property",
"s",
"feature",
"which",
"ar... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L902-L912 |
28,757 | apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | _get_interpretation_function | def _get_interpretation_function(interpretation, dtype):
"""
Retrieves the interpretation function used.
"""
type_string = dtype.__name__
name = "%s__%s" % (interpretation, type_string)
global _interpretations
if not hasattr(_interpretations, name):
raise ValueError("No transform ... | python | def _get_interpretation_function(interpretation, dtype):
"""
Retrieves the interpretation function used.
"""
type_string = dtype.__name__
name = "%s__%s" % (interpretation, type_string)
global _interpretations
if not hasattr(_interpretations, name):
raise ValueError("No transform ... | [
"def",
"_get_interpretation_function",
"(",
"interpretation",
",",
"dtype",
")",
":",
"type_string",
"=",
"dtype",
".",
"__name__",
"name",
"=",
"\"%s__%s\"",
"%",
"(",
"interpretation",
",",
"type_string",
")",
"global",
"_interpretations",
"if",
"not",
"hasattr"... | Retrieves the interpretation function used. | [
"Retrieves",
"the",
"interpretation",
"function",
"used",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L380-L394 |
28,758 | apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | _get_interpretation_description_and_output_type | def _get_interpretation_description_and_output_type(interpretation, dtype):
"""
Returns the description and output type for a given interpretation.
"""
type_string = dtype.__name__
name = "%s__%s" % (interpretation, type_string)
if not hasattr(_interpretations_class, name):
raise Value... | python | def _get_interpretation_description_and_output_type(interpretation, dtype):
"""
Returns the description and output type for a given interpretation.
"""
type_string = dtype.__name__
name = "%s__%s" % (interpretation, type_string)
if not hasattr(_interpretations_class, name):
raise Value... | [
"def",
"_get_interpretation_description_and_output_type",
"(",
"interpretation",
",",
"dtype",
")",
":",
"type_string",
"=",
"dtype",
".",
"__name__",
"name",
"=",
"\"%s__%s\"",
"%",
"(",
"interpretation",
",",
"type_string",
")",
"if",
"not",
"hasattr",
"(",
"_in... | Returns the description and output type for a given interpretation. | [
"Returns",
"the",
"description",
"and",
"output",
"type",
"for",
"a",
"given",
"interpretation",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L396-L411 |
28,759 | apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | _get_embeddable_interpretation_doc | def _get_embeddable_interpretation_doc(indent = 0):
"""
Returns a list of the available interpretations and what they do.
If indent is specified, then the entire doc string is indented by that amount.
"""
output_rows = []
# Pull out the doc string and put it in a table.
for name in sorted... | python | def _get_embeddable_interpretation_doc(indent = 0):
"""
Returns a list of the available interpretations and what they do.
If indent is specified, then the entire doc string is indented by that amount.
"""
output_rows = []
# Pull out the doc string and put it in a table.
for name in sorted... | [
"def",
"_get_embeddable_interpretation_doc",
"(",
"indent",
"=",
"0",
")",
":",
"output_rows",
"=",
"[",
"]",
"# Pull out the doc string and put it in a table.",
"for",
"name",
"in",
"sorted",
"(",
"dir",
"(",
"_interpretations",
")",
")",
":",
"if",
"name",
".",
... | Returns a list of the available interpretations and what they do.
If indent is specified, then the entire doc string is indented by that amount. | [
"Returns",
"a",
"list",
"of",
"the",
"available",
"interpretations",
"and",
"what",
"they",
"do",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L413-L436 |
28,760 | apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | _ColumnFunctionTransformation._load_version | def _load_version(cls, unpickler, version):
"""
A function to load a previously saved SentenceSplitter instance.
Parameters
----------
unpickler : GLUnpickler
A GLUnpickler file handler.
version : int
Version number maintained by the class writer... | python | def _load_version(cls, unpickler, version):
"""
A function to load a previously saved SentenceSplitter instance.
Parameters
----------
unpickler : GLUnpickler
A GLUnpickler file handler.
version : int
Version number maintained by the class writer... | [
"def",
"_load_version",
"(",
"cls",
",",
"unpickler",
",",
"version",
")",
":",
"state",
",",
"_exclude",
",",
"_features",
"=",
"unpickler",
".",
"load",
"(",
")",
"features",
"=",
"state",
"[",
"'features'",
"]",
"excluded_features",
"=",
"state",
"[",
... | A function to load a previously saved SentenceSplitter instance.
Parameters
----------
unpickler : GLUnpickler
A GLUnpickler file handler.
version : int
Version number maintained by the class writer. | [
"A",
"function",
"to",
"load",
"a",
"previously",
"saved",
"SentenceSplitter",
"instance",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L72-L95 |
28,761 | apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | _ColumnFunctionTransformation.fit | def fit(self, data):
"""
Fits the transformer using the given data.
"""
_raise_error_if_not_sframe(data, "data")
fitted_state = {}
feature_columns = _internal_utils.get_column_names(data, self._exclude, self._features)
if not feature_columns:
raise ... | python | def fit(self, data):
"""
Fits the transformer using the given data.
"""
_raise_error_if_not_sframe(data, "data")
fitted_state = {}
feature_columns = _internal_utils.get_column_names(data, self._exclude, self._features)
if not feature_columns:
raise ... | [
"def",
"fit",
"(",
"self",
",",
"data",
")",
":",
"_raise_error_if_not_sframe",
"(",
"data",
",",
"\"data\"",
")",
"fitted_state",
"=",
"{",
"}",
"feature_columns",
"=",
"_internal_utils",
".",
"get_column_names",
"(",
"data",
",",
"self",
".",
"_exclude",
"... | Fits the transformer using the given data. | [
"Fits",
"the",
"transformer",
"using",
"the",
"given",
"data",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L151-L169 |
28,762 | apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | _ColumnFunctionTransformation.transform | def transform(self, data):
"""
Transforms the data.
"""
if not self._get("fitted"):
raise RuntimeError("`transform` called before `fit` or `fit_transform`.")
data = data.copy()
output_column_prefix = self._get("output_column_prefix")
if output_colum... | python | def transform(self, data):
"""
Transforms the data.
"""
if not self._get("fitted"):
raise RuntimeError("`transform` called before `fit` or `fit_transform`.")
data = data.copy()
output_column_prefix = self._get("output_column_prefix")
if output_colum... | [
"def",
"transform",
"(",
"self",
",",
"data",
")",
":",
"if",
"not",
"self",
".",
"_get",
"(",
"\"fitted\"",
")",
":",
"raise",
"RuntimeError",
"(",
"\"`transform` called before `fit` or `fit_transform`.\"",
")",
"data",
"=",
"data",
".",
"copy",
"(",
")",
"... | Transforms the data. | [
"Transforms",
"the",
"data",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L171-L195 |
28,763 | apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | _interpretations_class.short_text__str | def short_text__str(self, column_name, output_column_prefix):
"""
Transforms short text into a dictionary of TFIDF-weighted 3-gram
character counts.
"""
from ._ngram_counter import NGramCounter
from ._tfidf import TFIDF
return [NGramCounter(features=[column_name... | python | def short_text__str(self, column_name, output_column_prefix):
"""
Transforms short text into a dictionary of TFIDF-weighted 3-gram
character counts.
"""
from ._ngram_counter import NGramCounter
from ._tfidf import TFIDF
return [NGramCounter(features=[column_name... | [
"def",
"short_text__str",
"(",
"self",
",",
"column_name",
",",
"output_column_prefix",
")",
":",
"from",
".",
"_ngram_counter",
"import",
"NGramCounter",
"from",
".",
"_tfidf",
"import",
"TFIDF",
"return",
"[",
"NGramCounter",
"(",
"features",
"=",
"[",
"column... | Transforms short text into a dictionary of TFIDF-weighted 3-gram
character counts. | [
"Transforms",
"short",
"text",
"into",
"a",
"dictionary",
"of",
"TFIDF",
"-",
"weighted",
"3",
"-",
"gram",
"character",
"counts",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L224-L241 |
28,764 | apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | _interpretations_class.categorical__int | def categorical__int(self, column_name, output_column_prefix):
"""
Interprets an integer column as a categorical variable.
"""
return [_ColumnFunctionTransformation(
features = [column_name],
output_column_prefix = output_column_prefix,
transform_func... | python | def categorical__int(self, column_name, output_column_prefix):
"""
Interprets an integer column as a categorical variable.
"""
return [_ColumnFunctionTransformation(
features = [column_name],
output_column_prefix = output_column_prefix,
transform_func... | [
"def",
"categorical__int",
"(",
"self",
",",
"column_name",
",",
"output_column_prefix",
")",
":",
"return",
"[",
"_ColumnFunctionTransformation",
"(",
"features",
"=",
"[",
"column_name",
"]",
",",
"output_column_prefix",
"=",
"output_column_prefix",
",",
"transform_... | Interprets an integer column as a categorical variable. | [
"Interprets",
"an",
"integer",
"column",
"as",
"a",
"categorical",
"variable",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L283-L292 |
28,765 | apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | AutoVectorizer._setup_from_data | def _setup_from_data(self, data):
"""
Sets up the content transforms.
"""
fitted_state = {}
_raise_error_if_not_of_type(data, [_SFrame])
feature_columns = _internal_utils.get_column_names(data, self._exclude, self._features)
if not feature_columns:
... | python | def _setup_from_data(self, data):
"""
Sets up the content transforms.
"""
fitted_state = {}
_raise_error_if_not_of_type(data, [_SFrame])
feature_columns = _internal_utils.get_column_names(data, self._exclude, self._features)
if not feature_columns:
... | [
"def",
"_setup_from_data",
"(",
"self",
",",
"data",
")",
":",
"fitted_state",
"=",
"{",
"}",
"_raise_error_if_not_of_type",
"(",
"data",
",",
"[",
"_SFrame",
"]",
")",
"feature_columns",
"=",
"_internal_utils",
".",
"get_column_names",
"(",
"data",
",",
"self... | Sets up the content transforms. | [
"Sets",
"up",
"the",
"content",
"transforms",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L550-L619 |
28,766 | apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | AutoVectorizer.fit_transform | def fit_transform(self, data):
"""
Fits and transforms the SFrame `data` using a fitted model.
Parameters
----------
data : SFrame
The data to be transformed.
Returns
-------
A transformed SFrame.
Returns
-------
out... | python | def fit_transform(self, data):
"""
Fits and transforms the SFrame `data` using a fitted model.
Parameters
----------
data : SFrame
The data to be transformed.
Returns
-------
A transformed SFrame.
Returns
-------
out... | [
"def",
"fit_transform",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"_setup_from_data",
"(",
"data",
")",
"ret",
"=",
"self",
".",
"transform_chain",
".",
"fit_transform",
"(",
"data",
")",
"self",
".",
"__proxy__",
".",
"update",
"(",
"{",
"\"fitte... | Fits and transforms the SFrame `data` using a fitted model.
Parameters
----------
data : SFrame
The data to be transformed.
Returns
-------
A transformed SFrame.
Returns
-------
out: SFrame
A transformed SFrame.
... | [
"Fits",
"and",
"transforms",
"the",
"SFrame",
"data",
"using",
"a",
"fitted",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L645-L671 |
28,767 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | Mox.CreateMock | def CreateMock(self, class_to_mock):
"""Create a new mock object.
Args:
# class_to_mock: the class to be mocked
class_to_mock: class
Returns:
MockObject that can be used as the class_to_mock would be.
"""
new_mock = MockObject(class_to_mock)
self._mock_objects.append(new_moc... | python | def CreateMock(self, class_to_mock):
"""Create a new mock object.
Args:
# class_to_mock: the class to be mocked
class_to_mock: class
Returns:
MockObject that can be used as the class_to_mock would be.
"""
new_mock = MockObject(class_to_mock)
self._mock_objects.append(new_moc... | [
"def",
"CreateMock",
"(",
"self",
",",
"class_to_mock",
")",
":",
"new_mock",
"=",
"MockObject",
"(",
"class_to_mock",
")",
"self",
".",
"_mock_objects",
".",
"append",
"(",
"new_mock",
")",
"return",
"new_mock"
] | Create a new mock object.
Args:
# class_to_mock: the class to be mocked
class_to_mock: class
Returns:
MockObject that can be used as the class_to_mock would be. | [
"Create",
"a",
"new",
"mock",
"object",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L164-L177 |
28,768 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | Mox.StubOutWithMock | def StubOutWithMock(self, obj, attr_name, use_mock_anything=False):
"""Replace a method, attribute, etc. with a Mock.
This will replace a class or module with a MockObject, and everything else
(method, function, etc) with a MockAnything. This can be overridden to
always use a MockAnything by setting u... | python | def StubOutWithMock(self, obj, attr_name, use_mock_anything=False):
"""Replace a method, attribute, etc. with a Mock.
This will replace a class or module with a MockObject, and everything else
(method, function, etc) with a MockAnything. This can be overridden to
always use a MockAnything by setting u... | [
"def",
"StubOutWithMock",
"(",
"self",
",",
"obj",
",",
"attr_name",
",",
"use_mock_anything",
"=",
"False",
")",
":",
"attr_to_replace",
"=",
"getattr",
"(",
"obj",
",",
"attr_name",
")",
"if",
"type",
"(",
"attr_to_replace",
")",
"in",
"self",
".",
"_USE... | Replace a method, attribute, etc. with a Mock.
This will replace a class or module with a MockObject, and everything else
(method, function, etc) with a MockAnything. This can be overridden to
always use a MockAnything by setting use_mock_anything to True.
Args:
obj: A Python object (class, mod... | [
"Replace",
"a",
"method",
"attribute",
"etc",
".",
"with",
"a",
"Mock",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L208-L228 |
28,769 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | MockAnything._Verify | def _Verify(self):
"""Verify that all of the expected calls have been made.
Raises:
ExpectedMethodCallsError: if there are still more method calls in the
expected queue.
"""
# If the list of expected calls is not empty, raise an exception
if self._expected_calls_queue:
# The la... | python | def _Verify(self):
"""Verify that all of the expected calls have been made.
Raises:
ExpectedMethodCallsError: if there are still more method calls in the
expected queue.
"""
# If the list of expected calls is not empty, raise an exception
if self._expected_calls_queue:
# The la... | [
"def",
"_Verify",
"(",
"self",
")",
":",
"# If the list of expected calls is not empty, raise an exception",
"if",
"self",
".",
"_expected_calls_queue",
":",
"# The last MultipleTimesGroup is not popped from the queue.",
"if",
"(",
"len",
"(",
"self",
".",
"_expected_calls_queu... | Verify that all of the expected calls have been made.
Raises:
ExpectedMethodCallsError: if there are still more method calls in the
expected queue. | [
"Verify",
"that",
"all",
"of",
"the",
"expected",
"calls",
"have",
"been",
"made",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L331-L347 |
28,770 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | MockMethod._VerifyMethodCall | def _VerifyMethodCall(self):
"""Verify the called method is expected.
This can be an ordered method, or part of an unordered set.
Returns:
The expected mock method.
Raises:
UnexpectedMethodCall if the method called was not expected.
"""
expected = self._PopNextMethod()
# Loo... | python | def _VerifyMethodCall(self):
"""Verify the called method is expected.
This can be an ordered method, or part of an unordered set.
Returns:
The expected mock method.
Raises:
UnexpectedMethodCall if the method called was not expected.
"""
expected = self._PopNextMethod()
# Loo... | [
"def",
"_VerifyMethodCall",
"(",
"self",
")",
":",
"expected",
"=",
"self",
".",
"_PopNextMethod",
"(",
")",
"# Loop here, because we might have a MethodGroup followed by another",
"# group.",
"while",
"isinstance",
"(",
"expected",
",",
"MethodGroup",
")",
":",
"expect... | Verify the called method is expected.
This can be an ordered method, or part of an unordered set.
Returns:
The expected mock method.
Raises:
UnexpectedMethodCall if the method called was not expected. | [
"Verify",
"the",
"called",
"method",
"is",
"expected",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L588-L613 |
28,771 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | MockMethod.GetPossibleGroup | def GetPossibleGroup(self):
"""Returns a possible group from the end of the call queue or None if no
other methods are on the stack.
"""
# Remove this method from the tail of the queue so we can add it to a group.
this_method = self._call_queue.pop()
assert this_method == self
# Determine ... | python | def GetPossibleGroup(self):
"""Returns a possible group from the end of the call queue or None if no
other methods are on the stack.
"""
# Remove this method from the tail of the queue so we can add it to a group.
this_method = self._call_queue.pop()
assert this_method == self
# Determine ... | [
"def",
"GetPossibleGroup",
"(",
"self",
")",
":",
"# Remove this method from the tail of the queue so we can add it to a group.",
"this_method",
"=",
"self",
".",
"_call_queue",
".",
"pop",
"(",
")",
"assert",
"this_method",
"==",
"self",
"# Determine if the tail of the queue... | Returns a possible group from the end of the call queue or None if no
other methods are on the stack. | [
"Returns",
"a",
"possible",
"group",
"from",
"the",
"end",
"of",
"the",
"call",
"queue",
"or",
"None",
"if",
"no",
"other",
"methods",
"are",
"on",
"the",
"stack",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L645-L662 |
28,772 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | IsA.equals | def equals(self, rhs):
"""Check to see if the RHS is an instance of class_name.
Args:
# rhs: the right hand side of the test
rhs: object
Returns:
bool
"""
try:
return isinstance(rhs, self._class_name)
except TypeError:
# Check raw types if there was a type error.... | python | def equals(self, rhs):
"""Check to see if the RHS is an instance of class_name.
Args:
# rhs: the right hand side of the test
rhs: object
Returns:
bool
"""
try:
return isinstance(rhs, self._class_name)
except TypeError:
# Check raw types if there was a type error.... | [
"def",
"equals",
"(",
"self",
",",
"rhs",
")",
":",
"try",
":",
"return",
"isinstance",
"(",
"rhs",
",",
"self",
".",
"_class_name",
")",
"except",
"TypeError",
":",
"# Check raw types if there was a type error. This is helpful for",
"# things like cStringIO.StringIO."... | Check to see if the RHS is an instance of class_name.
Args:
# rhs: the right hand side of the test
rhs: object
Returns:
bool | [
"Check",
"to",
"see",
"if",
"the",
"RHS",
"is",
"an",
"instance",
"of",
"class_name",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L807-L823 |
28,773 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | IsAlmost.equals | def equals(self, rhs):
"""Check to see if RHS is almost equal to float_value
Args:
rhs: the value to compare to float_value
Returns:
bool
"""
try:
return round(rhs-self._float_value, self._places) == 0
except TypeError:
# This is probably because either float_value or ... | python | def equals(self, rhs):
"""Check to see if RHS is almost equal to float_value
Args:
rhs: the value to compare to float_value
Returns:
bool
"""
try:
return round(rhs-self._float_value, self._places) == 0
except TypeError:
# This is probably because either float_value or ... | [
"def",
"equals",
"(",
"self",
",",
"rhs",
")",
":",
"try",
":",
"return",
"round",
"(",
"rhs",
"-",
"self",
".",
"_float_value",
",",
"self",
".",
"_places",
")",
"==",
"0",
"except",
"TypeError",
":",
"# This is probably because either float_value or rhs is n... | Check to see if RHS is almost equal to float_value
Args:
rhs: the value to compare to float_value
Returns:
bool | [
"Check",
"to",
"see",
"if",
"RHS",
"is",
"almost",
"equal",
"to",
"float_value"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L846-L860 |
28,774 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | SameElementsAs.equals | def equals(self, actual_seq):
"""Check to see whether actual_seq has same elements as expected_seq.
Args:
actual_seq: sequence
Returns:
bool
"""
try:
expected = dict([(element, None) for element in self._expected_seq])
actual = dict([(element, None) for element in actual_s... | python | def equals(self, actual_seq):
"""Check to see whether actual_seq has same elements as expected_seq.
Args:
actual_seq: sequence
Returns:
bool
"""
try:
expected = dict([(element, None) for element in self._expected_seq])
actual = dict([(element, None) for element in actual_s... | [
"def",
"equals",
"(",
"self",
",",
"actual_seq",
")",
":",
"try",
":",
"expected",
"=",
"dict",
"(",
"[",
"(",
"element",
",",
"None",
")",
"for",
"element",
"in",
"self",
".",
"_expected_seq",
"]",
")",
"actual",
"=",
"dict",
"(",
"[",
"(",
"eleme... | Check to see whether actual_seq has same elements as expected_seq.
Args:
actual_seq: sequence
Returns:
bool | [
"Check",
"to",
"see",
"whether",
"actual_seq",
"has",
"same",
"elements",
"as",
"expected_seq",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L1021-L1040 |
28,775 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | Or.equals | def equals(self, rhs):
"""Checks whether any Comparator is equal to rhs.
Args:
# rhs: can be anything
Returns:
bool
"""
for comparator in self._comparators:
if comparator.equals(rhs):
return True
return False | python | def equals(self, rhs):
"""Checks whether any Comparator is equal to rhs.
Args:
# rhs: can be anything
Returns:
bool
"""
for comparator in self._comparators:
if comparator.equals(rhs):
return True
return False | [
"def",
"equals",
"(",
"self",
",",
"rhs",
")",
":",
"for",
"comparator",
"in",
"self",
".",
"_comparators",
":",
"if",
"comparator",
".",
"equals",
"(",
"rhs",
")",
":",
"return",
"True",
"return",
"False"
] | Checks whether any Comparator is equal to rhs.
Args:
# rhs: can be anything
Returns:
bool | [
"Checks",
"whether",
"any",
"Comparator",
"is",
"equal",
"to",
"rhs",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L1092-L1106 |
28,776 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | MultipleTimesGroup.IsSatisfied | def IsSatisfied(self):
"""Return True if all methods in this group are called at least once."""
# NOTE(psycho): We can't use the simple set difference here because we want
# to match different parameters which are considered the same e.g. IsA(str)
# and some string. This solution is O(n^2) but n should ... | python | def IsSatisfied(self):
"""Return True if all methods in this group are called at least once."""
# NOTE(psycho): We can't use the simple set difference here because we want
# to match different parameters which are considered the same e.g. IsA(str)
# and some string. This solution is O(n^2) but n should ... | [
"def",
"IsSatisfied",
"(",
"self",
")",
":",
"# NOTE(psycho): We can't use the simple set difference here because we want",
"# to match different parameters which are considered the same e.g. IsA(str)",
"# and some string. This solution is O(n^2) but n should be small.",
"tmp",
"=",
"self",
... | Return True if all methods in this group are called at least once. | [
"Return",
"True",
"if",
"all",
"methods",
"in",
"this",
"group",
"are",
"called",
"at",
"least",
"once",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L1318-L1331 |
28,777 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/_interface_management.py | set_classifier_interface_params | def set_classifier_interface_params(spec, features, class_labels,
model_accessor_for_class_labels, output_features = None):
"""
Common utilities to set the regression interface params.
"""
# Normalize the features list.
features = _fm.process_or_validate_features(features)
if class_labe... | python | def set_classifier_interface_params(spec, features, class_labels,
model_accessor_for_class_labels, output_features = None):
"""
Common utilities to set the regression interface params.
"""
# Normalize the features list.
features = _fm.process_or_validate_features(features)
if class_labe... | [
"def",
"set_classifier_interface_params",
"(",
"spec",
",",
"features",
",",
"class_labels",
",",
"model_accessor_for_class_labels",
",",
"output_features",
"=",
"None",
")",
":",
"# Normalize the features list.",
"features",
"=",
"_fm",
".",
"process_or_validate_features",... | Common utilities to set the regression interface params. | [
"Common",
"utilities",
"to",
"set",
"the",
"regression",
"interface",
"params",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/_interface_management.py#L13-L100 |
28,778 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/_interface_management.py | set_regressor_interface_params | def set_regressor_interface_params(spec, features, output_features):
""" Common utilities to set the regressor interface params.
"""
if output_features is None:
output_features = [("predicted_class", datatypes.Double())]
else:
output_features = _fm.process_or_validate_features(output_fea... | python | def set_regressor_interface_params(spec, features, output_features):
""" Common utilities to set the regressor interface params.
"""
if output_features is None:
output_features = [("predicted_class", datatypes.Double())]
else:
output_features = _fm.process_or_validate_features(output_fea... | [
"def",
"set_regressor_interface_params",
"(",
"spec",
",",
"features",
",",
"output_features",
")",
":",
"if",
"output_features",
"is",
"None",
":",
"output_features",
"=",
"[",
"(",
"\"predicted_class\"",
",",
"datatypes",
".",
"Double",
"(",
")",
")",
"]",
"... | Common utilities to set the regressor interface params. | [
"Common",
"utilities",
"to",
"set",
"the",
"regressor",
"interface",
"params",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/_interface_management.py#L102-L132 |
28,779 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/_interface_management.py | set_transform_interface_params | def set_transform_interface_params(spec, input_features, output_features, are_optional = False):
""" Common utilities to set transform interface params.
"""
input_features = _fm.process_or_validate_features(input_features)
output_features = _fm.process_or_validate_features(output_features)
# Add in... | python | def set_transform_interface_params(spec, input_features, output_features, are_optional = False):
""" Common utilities to set transform interface params.
"""
input_features = _fm.process_or_validate_features(input_features)
output_features = _fm.process_or_validate_features(output_features)
# Add in... | [
"def",
"set_transform_interface_params",
"(",
"spec",
",",
"input_features",
",",
"output_features",
",",
"are_optional",
"=",
"False",
")",
":",
"input_features",
"=",
"_fm",
".",
"process_or_validate_features",
"(",
"input_features",
")",
"output_features",
"=",
"_f... | Common utilities to set transform interface params. | [
"Common",
"utilities",
"to",
"set",
"transform",
"interface",
"params",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/_interface_management.py#L134-L153 |
28,780 | apple/turicreate | src/unity/python/turicreate/toolkits/activity_classifier/_sframe_sequence_iterator.py | _load_into_numpy | def _load_into_numpy(sf, np_array, start, end, strides=None, shape=None):
"""Loads into numpy array from SFrame, assuming SFrame stores data flattened"""
np_array[:] = 0.0
np_array_2d = np_array.reshape((np_array.shape[0], np_array.shape[1] * np_array.shape[2]))
_extensions.sframe_load_to_numpy(sf, np_a... | python | def _load_into_numpy(sf, np_array, start, end, strides=None, shape=None):
"""Loads into numpy array from SFrame, assuming SFrame stores data flattened"""
np_array[:] = 0.0
np_array_2d = np_array.reshape((np_array.shape[0], np_array.shape[1] * np_array.shape[2]))
_extensions.sframe_load_to_numpy(sf, np_a... | [
"def",
"_load_into_numpy",
"(",
"sf",
",",
"np_array",
",",
"start",
",",
"end",
",",
"strides",
"=",
"None",
",",
"shape",
"=",
"None",
")",
":",
"np_array",
"[",
":",
"]",
"=",
"0.0",
"np_array_2d",
"=",
"np_array",
".",
"reshape",
"(",
"(",
"np_ar... | Loads into numpy array from SFrame, assuming SFrame stores data flattened | [
"Loads",
"into",
"numpy",
"array",
"from",
"SFrame",
"assuming",
"SFrame",
"stores",
"data",
"flattened"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/activity_classifier/_sframe_sequence_iterator.py#L49-L55 |
28,781 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.set_input | def set_input(self, input_names, input_dims):
"""
Set the inputs of the network spec.
Parameters
----------
input_names: [str]
List of input names of the network.
input_dims: [tuple]
List of input dimensions of the network. The ordering of input_... | python | def set_input(self, input_names, input_dims):
"""
Set the inputs of the network spec.
Parameters
----------
input_names: [str]
List of input names of the network.
input_dims: [tuple]
List of input dimensions of the network. The ordering of input_... | [
"def",
"set_input",
"(",
"self",
",",
"input_names",
",",
"input_dims",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"for",
"idx",
",",
"dim",
"in",
"enumerate",
"(",
"input_dims",
")",
":",
"if",
"len",
"(",
"d... | Set the inputs of the network spec.
Parameters
----------
input_names: [str]
List of input names of the network.
input_dims: [tuple]
List of input dimensions of the network. The ordering of input_dims
is the same as input_names.
Examples
... | [
"Set",
"the",
"inputs",
"of",
"the",
"network",
"spec",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L159-L202 |
28,782 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.set_output | def set_output(self, output_names, output_dims):
"""
Set the outputs of the network spec.
Parameters
----------
output_names: [str]
List of output names of the network.
output_dims: [tuple]
List of output dimensions of the network. The ordering o... | python | def set_output(self, output_names, output_dims):
"""
Set the outputs of the network spec.
Parameters
----------
output_names: [str]
List of output names of the network.
output_dims: [tuple]
List of output dimensions of the network. The ordering o... | [
"def",
"set_output",
"(",
"self",
",",
"output_names",
",",
"output_dims",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"for",
"idx",
",",
"dim",
"in",
"enumerate",
"(",
"output_dims",
")",
":",
"spec",
".",
"desc... | Set the outputs of the network spec.
Parameters
----------
output_names: [str]
List of output names of the network.
output_dims: [tuple]
List of output dimensions of the network. The ordering of output_dims is the same
as output_names.
Examp... | [
"Set",
"the",
"outputs",
"of",
"the",
"network",
"spec",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L204-L235 |
28,783 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.set_class_labels | def set_class_labels(self, class_labels, predicted_feature_name = 'classLabel', prediction_blob = ''):
"""
Set class labels to the model spec to make it a neural network classifier.
Parameters
----------
class_labels: list[int or str]
A list of integers or strings th... | python | def set_class_labels(self, class_labels, predicted_feature_name = 'classLabel', prediction_blob = ''):
"""
Set class labels to the model spec to make it a neural network classifier.
Parameters
----------
class_labels: list[int or str]
A list of integers or strings th... | [
"def",
"set_class_labels",
"(",
"self",
",",
"class_labels",
",",
"predicted_feature_name",
"=",
"'classLabel'",
",",
"prediction_blob",
"=",
"''",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"if",
"len",
"(",
"spec",
... | Set class labels to the model spec to make it a neural network classifier.
Parameters
----------
class_labels: list[int or str]
A list of integers or strings that map the index of the output of a
neural network to labels in a classifier.
predicted_feature_name: ... | [
"Set",
"class",
"labels",
"to",
"the",
"model",
"spec",
"to",
"make",
"it",
"a",
"neural",
"network",
"classifier",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L237-L299 |
28,784 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_optionals | def add_optionals(self, optionals_in, optionals_out):
"""
Add optional inputs and outputs to the model spec.
Parameters
----------
optionals_in: [str]
List of inputs that are optionals.
optionals_out: [str]
List of outputs that are optionals.
... | python | def add_optionals(self, optionals_in, optionals_out):
"""
Add optional inputs and outputs to the model spec.
Parameters
----------
optionals_in: [str]
List of inputs that are optionals.
optionals_out: [str]
List of outputs that are optionals.
... | [
"def",
"add_optionals",
"(",
"self",
",",
"optionals_in",
",",
"optionals_out",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"if",
"(",
"not",
"optionals_in",
")",
"and",
"(",
"not",
"optionals_out",
")",
":",
"return",
"# assuming single sizes here",
"input_ty... | Add optional inputs and outputs to the model spec.
Parameters
----------
optionals_in: [str]
List of inputs that are optionals.
optionals_out: [str]
List of outputs that are optionals.
See Also
--------
set_input, set_output | [
"Add",
"optional",
"inputs",
"and",
"outputs",
"to",
"the",
"model",
"spec",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L302-L343 |
28,785 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_embedding | def add_embedding(self, name, W, b, input_dim, output_channels, has_bias,
input_name, output_name):
"""
Add an embedding layer to the model.
Parameters
----------
name: str
The name of this layer
W: numpy.array
Weight matrix ... | python | def add_embedding(self, name, W, b, input_dim, output_channels, has_bias,
input_name, output_name):
"""
Add an embedding layer to the model.
Parameters
----------
name: str
The name of this layer
W: numpy.array
Weight matrix ... | [
"def",
"add_embedding",
"(",
"self",
",",
"name",
",",
"W",
",",
"b",
",",
"input_dim",
",",
"output_channels",
",",
"has_bias",
",",
"input_name",
",",
"output_name",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
... | Add an embedding layer to the model.
Parameters
----------
name: str
The name of this layer
W: numpy.array
Weight matrix of shape (output_channels, input_dim).
b: numpy.array
Bias vector of shape (output_channels, ).
input_dim: int
... | [
"Add",
"an",
"embedding",
"layer",
"to",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L400-L453 |
28,786 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_softmax | def add_softmax(self, name, input_name, output_name):
"""
Add a softmax layer to the model.
Parameters
----------
name: str
The name of this layer.
input_name: str
The input blob name of this layer.
output_name: str
The output ... | python | def add_softmax(self, name, input_name, output_name):
"""
Add a softmax layer to the model.
Parameters
----------
name: str
The name of this layer.
input_name: str
The input blob name of this layer.
output_name: str
The output ... | [
"def",
"add_softmax",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",
"=",
"nn_spec",
".",
"layers",
".",
"add",
"(",
... | Add a softmax layer to the model.
Parameters
----------
name: str
The name of this layer.
input_name: str
The input blob name of this layer.
output_name: str
The output blob name of this layer.
See Also
--------
add_ac... | [
"Add",
"a",
"softmax",
"layer",
"to",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L456-L482 |
28,787 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_activation | def add_activation(self, name, non_linearity, input_name, output_name,
params=None):
"""
Add an activation layer to the model.
Parameters
----------
name: str
The name of this layer
non_linearity: str
The non_linearity (activation) functio... | python | def add_activation(self, name, non_linearity, input_name, output_name,
params=None):
"""
Add an activation layer to the model.
Parameters
----------
name: str
The name of this layer
non_linearity: str
The non_linearity (activation) functio... | [
"def",
"add_activation",
"(",
"self",
",",
"name",
",",
"non_linearity",
",",
"input_name",
",",
"output_name",
",",
"params",
"=",
"None",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",... | Add an activation layer to the model.
Parameters
----------
name: str
The name of this layer
non_linearity: str
The non_linearity (activation) function of this layer.
It can be one of the following:
- 'RELU': Rectified Linear Unit (Re... | [
"Add",
"an",
"activation",
"layer",
"to",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L484-L648 |
28,788 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_elementwise | def add_elementwise(self, name, input_names, output_name, mode, alpha = None):
"""
Add an element-wise operation layer to the model.
Parameters
----------
The name of this layer
name: str
input_names: [str]
A list of input blob names of this layer... | python | def add_elementwise(self, name, input_names, output_name, mode, alpha = None):
"""
Add an element-wise operation layer to the model.
Parameters
----------
The name of this layer
name: str
input_names: [str]
A list of input blob names of this layer... | [
"def",
"add_elementwise",
"(",
"self",
",",
"name",
",",
"input_names",
",",
"output_name",
",",
"mode",
",",
"alpha",
"=",
"None",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"spec_layer",
"=",
"nn_spec",
".",
"... | Add an element-wise operation layer to the model.
Parameters
----------
The name of this layer
name: str
input_names: [str]
A list of input blob names of this layer. The input blobs should have the same shape.
output_name: str
The output blob ... | [
"Add",
"an",
"element",
"-",
"wise",
"operation",
"layer",
"to",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L650-L721 |
28,789 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_upsample | def add_upsample(self, name, scaling_factor_h, scaling_factor_w, input_name, output_name, mode = 'NN'):
"""
Add upsample layer to the model.
Parameters
----------
name: str
The name of this layer.
scaling_factor_h: int
Scaling factor on the vertic... | python | def add_upsample(self, name, scaling_factor_h, scaling_factor_w, input_name, output_name, mode = 'NN'):
"""
Add upsample layer to the model.
Parameters
----------
name: str
The name of this layer.
scaling_factor_h: int
Scaling factor on the vertic... | [
"def",
"add_upsample",
"(",
"self",
",",
"name",
",",
"scaling_factor_h",
",",
"scaling_factor_w",
",",
"input_name",
",",
"output_name",
",",
"mode",
"=",
"'NN'",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a... | Add upsample layer to the model.
Parameters
----------
name: str
The name of this layer.
scaling_factor_h: int
Scaling factor on the vertical direction.
scaling_factor_w: int
Scaling factor on the horizontal direction.
input_name: str
... | [
"Add",
"upsample",
"layer",
"to",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L723-L764 |
28,790 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_scale | def add_scale(self, name, W, b, has_bias, input_name, output_name, shape_scale = [1], shape_bias = [1]):
"""
Add scale layer to the model.
Parameters
----------
name: str
The name of this layer.
W: int | numpy.array
Scale of the input.
b: ... | python | def add_scale(self, name, W, b, has_bias, input_name, output_name, shape_scale = [1], shape_bias = [1]):
"""
Add scale layer to the model.
Parameters
----------
name: str
The name of this layer.
W: int | numpy.array
Scale of the input.
b: ... | [
"def",
"add_scale",
"(",
"self",
",",
"name",
",",
"W",
",",
"b",
",",
"has_bias",
",",
"input_name",
",",
"output_name",
",",
"shape_scale",
"=",
"[",
"1",
"]",
",",
"shape_bias",
"=",
"[",
"1",
"]",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"... | Add scale layer to the model.
Parameters
----------
name: str
The name of this layer.
W: int | numpy.array
Scale of the input.
b: int | numpy.array
Bias to add to the input.
has_bias: boolean
Whether the bias vector of this... | [
"Add",
"scale",
"layer",
"to",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L766-L824 |
28,791 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_bias | def add_bias(self, name, b, input_name, output_name, shape_bias = [1]):
"""
Add bias layer to the model.
Parameters
----------
name: str
The name of this layer.
b: int | numpy.array
Bias to add to the input.
input_name: str
The... | python | def add_bias(self, name, b, input_name, output_name, shape_bias = [1]):
"""
Add bias layer to the model.
Parameters
----------
name: str
The name of this layer.
b: int | numpy.array
Bias to add to the input.
input_name: str
The... | [
"def",
"add_bias",
"(",
"self",
",",
"name",
",",
"b",
",",
"input_name",
",",
"output_name",
",",
"shape_bias",
"=",
"[",
"1",
"]",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"spec_layer",
"=",
"nn_spec",
"."... | Add bias layer to the model.
Parameters
----------
name: str
The name of this layer.
b: int | numpy.array
Bias to add to the input.
input_name: str
The input blob name of this layer.
output_name: str
The output blob name of... | [
"Add",
"bias",
"layer",
"to",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L826-L864 |
28,792 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_sequence_repeat | def add_sequence_repeat(self, name, nrep, input_name, output_name):
"""
Add sequence repeat layer to the model.
Parameters
----------
name: str
The name of this layer.
nrep: int
Number of repetitions of the input blob along the sequence axis.
... | python | def add_sequence_repeat(self, name, nrep, input_name, output_name):
"""
Add sequence repeat layer to the model.
Parameters
----------
name: str
The name of this layer.
nrep: int
Number of repetitions of the input blob along the sequence axis.
... | [
"def",
"add_sequence_repeat",
"(",
"self",
",",
"name",
",",
"nrep",
",",
"input_name",
",",
"output_name",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"spec_layer",
"=",
"nn_spec",
".",
"layers",
".",
"add",
"(",
... | Add sequence repeat layer to the model.
Parameters
----------
name: str
The name of this layer.
nrep: int
Number of repetitions of the input blob along the sequence axis.
input_name: str
The input blob name of this layer.
output_name: ... | [
"Add",
"sequence",
"repeat",
"layer",
"to",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L866-L892 |
28,793 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_padding | def add_padding(self, name,
left = 0, right = 0, top = 0, bottom = 0,
value = 0,
input_name = 'data', output_name = 'out',
padding_type = 'constant'):
"""
Add a padding layer to the model. Kindly refer to NeuralNetwork.proto for details.
Parameter... | python | def add_padding(self, name,
left = 0, right = 0, top = 0, bottom = 0,
value = 0,
input_name = 'data', output_name = 'out',
padding_type = 'constant'):
"""
Add a padding layer to the model. Kindly refer to NeuralNetwork.proto for details.
Parameter... | [
"def",
"add_padding",
"(",
"self",
",",
"name",
",",
"left",
"=",
"0",
",",
"right",
"=",
"0",
",",
"top",
"=",
"0",
",",
"bottom",
"=",
"0",
",",
"value",
"=",
"0",
",",
"input_name",
"=",
"'data'",
",",
"output_name",
"=",
"'out'",
",",
"paddin... | Add a padding layer to the model. Kindly refer to NeuralNetwork.proto for details.
Parameters
----------
name: str
The name of this layer.
left: int
Number of elements to be padded on the left side of the input blob.
right: int
Number of eleme... | [
"Add",
"a",
"padding",
"layer",
"to",
"the",
"model",
".",
"Kindly",
"refer",
"to",
"NeuralNetwork",
".",
"proto",
"for",
"details",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1148-L1208 |
28,794 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_simple_rnn | def add_simple_rnn(self,name, W_h, W_x, b, hidden_size, input_size, activation, input_names, output_names, output_all = False, reverse_input = False):
"""
Add a simple recurrent layer to the model.
Parameters
----------
name: str
The name of this layer.
W_h: ... | python | def add_simple_rnn(self,name, W_h, W_x, b, hidden_size, input_size, activation, input_names, output_names, output_all = False, reverse_input = False):
"""
Add a simple recurrent layer to the model.
Parameters
----------
name: str
The name of this layer.
W_h: ... | [
"def",
"add_simple_rnn",
"(",
"self",
",",
"name",
",",
"W_h",
",",
"W_x",
",",
"b",
",",
"hidden_size",
",",
"input_size",
",",
"activation",
",",
"input_names",
",",
"output_names",
",",
"output_all",
"=",
"False",
",",
"reverse_input",
"=",
"False",
")"... | Add a simple recurrent layer to the model.
Parameters
----------
name: str
The name of this layer.
W_h: numpy.array
Weights of the recurrent layer's hidden state. Must be of shape (hidden_size, hidden_size).
W_x: numpy.array
Weights of the rec... | [
"Add",
"a",
"simple",
"recurrent",
"layer",
"to",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1271-L1341 |
28,795 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_flatten | def add_flatten(self, name, mode, input_name, output_name):
"""
Add a flatten layer. Only flattens the channel, height and width axis. Leaves the sequence axis as is.
Parameters
----------
name: str
The name of this layer.
mode: int
- If mode == ... | python | def add_flatten(self, name, mode, input_name, output_name):
"""
Add a flatten layer. Only flattens the channel, height and width axis. Leaves the sequence axis as is.
Parameters
----------
name: str
The name of this layer.
mode: int
- If mode == ... | [
"def",
"add_flatten",
"(",
"self",
",",
"name",
",",
"mode",
",",
"input_name",
",",
"output_name",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",
"=",
"nn_spec",
".",
"layers",
".",
... | Add a flatten layer. Only flattens the channel, height and width axis. Leaves the sequence axis as is.
Parameters
----------
name: str
The name of this layer.
mode: int
- If mode == 0, the flatten layer is in CHANNEL_FIRST mode.
- If mode == 1, the f... | [
"Add",
"a",
"flatten",
"layer",
".",
"Only",
"flattens",
"the",
"channel",
"height",
"and",
"width",
"axis",
".",
"Leaves",
"the",
"sequence",
"axis",
"as",
"is",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1761-L1802 |
28,796 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_reorganize_data | def add_reorganize_data(self, name, input_name, output_name, mode = 'SPACE_TO_DEPTH', block_size = 2):
"""
Add a data reorganization layer of type "SPACE_TO_DEPTH" or "DEPTH_TO_SPACE".
Parameters
----------
name: str
The name of this layer.
input_name: str
... | python | def add_reorganize_data(self, name, input_name, output_name, mode = 'SPACE_TO_DEPTH', block_size = 2):
"""
Add a data reorganization layer of type "SPACE_TO_DEPTH" or "DEPTH_TO_SPACE".
Parameters
----------
name: str
The name of this layer.
input_name: str
... | [
"def",
"add_reorganize_data",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
",",
"mode",
"=",
"'SPACE_TO_DEPTH'",
",",
"block_size",
"=",
"2",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a n... | Add a data reorganization layer of type "SPACE_TO_DEPTH" or "DEPTH_TO_SPACE".
Parameters
----------
name: str
The name of this layer.
input_name: str
The input blob name of this layer.
output_name: str
The output blob name of this layer.
... | [
"Add",
"a",
"data",
"reorganization",
"layer",
"of",
"type",
"SPACE_TO_DEPTH",
"or",
"DEPTH_TO_SPACE",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1867-L1922 |
28,797 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_reshape | def add_reshape(self, name, input_name, output_name, target_shape, mode):
"""
Add a reshape layer. Kindly refer to NeuralNetwork.proto for details.
Parameters
----------
name: str
The name of this layer.
target_shape: tuple
Shape of the output blo... | python | def add_reshape(self, name, input_name, output_name, target_shape, mode):
"""
Add a reshape layer. Kindly refer to NeuralNetwork.proto for details.
Parameters
----------
name: str
The name of this layer.
target_shape: tuple
Shape of the output blo... | [
"def",
"add_reshape",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
",",
"target_shape",
",",
"mode",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",
"=",
"nn_spec",
... | Add a reshape layer. Kindly refer to NeuralNetwork.proto for details.
Parameters
----------
name: str
The name of this layer.
target_shape: tuple
Shape of the output blob. The product of target_shape must be equal
to the shape of the input blob.
... | [
"Add",
"a",
"reshape",
"layer",
".",
"Kindly",
"refer",
"to",
"NeuralNetwork",
".",
"proto",
"for",
"details",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2048-L2094 |
28,798 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_l2_normalize | def add_l2_normalize(self, name, input_name, output_name, epsilon = 1e-5):
"""
Add L2 normalize layer. Normalizes the input by the L2 norm, i.e. divides by the
the square root of the sum of squares of all elements of the input along C, H and W dimensions.
Parameters
----------
... | python | def add_l2_normalize(self, name, input_name, output_name, epsilon = 1e-5):
"""
Add L2 normalize layer. Normalizes the input by the L2 norm, i.e. divides by the
the square root of the sum of squares of all elements of the input along C, H and W dimensions.
Parameters
----------
... | [
"def",
"add_l2_normalize",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
",",
"epsilon",
"=",
"1e-5",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",
"=",
"nn_spec",
... | Add L2 normalize layer. Normalizes the input by the L2 norm, i.e. divides by the
the square root of the sum of squares of all elements of the input along C, H and W dimensions.
Parameters
----------
name: str
The name of this layer.
input_name: str
The i... | [
"Add",
"L2",
"normalize",
"layer",
".",
"Normalizes",
"the",
"input",
"by",
"the",
"L2",
"norm",
"i",
".",
"e",
".",
"divides",
"by",
"the",
"the",
"square",
"root",
"of",
"the",
"sum",
"of",
"squares",
"of",
"all",
"elements",
"of",
"the",
"input",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2271-L2305 |
28,799 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_split | def add_split(self, name, input_name, output_names):
"""
Add a Split layer that uniformly splits the input along the channel dimension
to produce multiple outputs.
Parameters
----------
name: str
The name of this layer.
input_name: str
Th... | python | def add_split(self, name, input_name, output_names):
"""
Add a Split layer that uniformly splits the input along the channel dimension
to produce multiple outputs.
Parameters
----------
name: str
The name of this layer.
input_name: str
Th... | [
"def",
"add_split",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_names",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",
"=",
"nn_spec",
".",
"layers",
".",
"add",
"(",
"... | Add a Split layer that uniformly splits the input along the channel dimension
to produce multiple outputs.
Parameters
----------
name: str
The name of this layer.
input_name: str
The input blob name of this layer.
output_names: [str]
... | [
"Add",
"a",
"Split",
"layer",
"that",
"uniformly",
"splits",
"the",
"input",
"along",
"the",
"channel",
"dimension",
"to",
"produce",
"multiple",
"outputs",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2379-L2409 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.