partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
ProjectRegistry.load_module
Load a Python module that should be useable from Jamfiles. There are generally two types of modules Jamfiles might want to use: - Core Boost.Build. Those are imported using plain names, e.g. 'toolset', so this function checks if we have module named b2.package.module already. ...
deps/src/boost_1_68_0/tools/build/src/build/project.py
def load_module(self, name, extra_path=None): """Load a Python module that should be useable from Jamfiles. There are generally two types of modules Jamfiles might want to use: - Core Boost.Build. Those are imported using plain names, e.g. 'toolset', so this function checks if w...
def load_module(self, name, extra_path=None): """Load a Python module that should be useable from Jamfiles. There are generally two types of modules Jamfiles might want to use: - Core Boost.Build. Those are imported using plain names, e.g. 'toolset', so this function checks if w...
[ "Load", "a", "Python", "module", "that", "should", "be", "useable", "from", "Jamfiles", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L726-L806
[ "def", "load_module", "(", "self", ",", "name", ",", "extra_path", "=", "None", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "assert", "is_iterable_typed", "(", "extra_path", ",", "basestring", ")", "or", "extra_path", "is", "None",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectAttributes.set
Set the named attribute from the specification given by the user. The value actually set may be different.
deps/src/boost_1_68_0/tools/build/src/build/project.py
def set(self, attribute, specification, exact=False): """Set the named attribute from the specification given by the user. The value actually set may be different.""" assert isinstance(attribute, basestring) assert isinstance(exact, (int, bool)) if __debug__ and not exact: ...
def set(self, attribute, specification, exact=False): """Set the named attribute from the specification given by the user. The value actually set may be different.""" assert isinstance(attribute, basestring) assert isinstance(exact, (int, bool)) if __debug__ and not exact: ...
[ "Set", "the", "named", "attribute", "from", "the", "specification", "given", "by", "the", "user", ".", "The", "value", "actually", "set", "may", "be", "different", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L867-L944
[ "def", "set", "(", "self", ",", "attribute", ",", "specification", ",", "exact", "=", "False", ")", ":", "assert", "isinstance", "(", "attribute", ",", "basestring", ")", "assert", "isinstance", "(", "exact", ",", "(", "int", ",", "bool", ")", ")", "if...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectAttributes.dump
Prints the project attributes.
deps/src/boost_1_68_0/tools/build/src/build/project.py
def dump(self): """Prints the project attributes.""" id = self.get("id") if not id: id = "(none)" else: id = id[0] parent = self.get("parent") if not parent: parent = "(none)" else: parent = parent[0] print...
def dump(self): """Prints the project attributes.""" id = self.get("id") if not id: id = "(none)" else: id = id[0] parent = self.get("parent") if not parent: parent = "(none)" else: parent = parent[0] print...
[ "Prints", "the", "project", "attributes", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L954-L973
[ "def", "dump", "(", "self", ")", ":", "id", "=", "self", ".", "get", "(", "\"id\"", ")", "if", "not", "id", ":", "id", "=", "\"(none)\"", "else", ":", "id", "=", "id", "[", "0", "]", "parent", "=", "self", ".", "get", "(", "\"parent\"", ")", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectRules.make_wrapper
Given a free-standing function 'callable', return a new callable that will call 'callable' and report all exceptins, using 'call_and_report_errors'.
deps/src/boost_1_68_0/tools/build/src/build/project.py
def make_wrapper(self, callable_): """Given a free-standing function 'callable', return a new callable that will call 'callable' and report all exceptins, using 'call_and_report_errors'.""" assert callable(callable_) def wrapper(*args, **kw): return self.call_and_repo...
def make_wrapper(self, callable_): """Given a free-standing function 'callable', return a new callable that will call 'callable' and report all exceptins, using 'call_and_report_errors'.""" assert callable(callable_) def wrapper(*args, **kw): return self.call_and_repo...
[ "Given", "a", "free", "-", "standing", "function", "callable", "return", "a", "new", "callable", "that", "will", "call", "callable", "and", "report", "all", "exceptins", "using", "call_and_report_errors", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L1044-L1051
[ "def", "make_wrapper", "(", "self", ",", "callable_", ")", ":", "assert", "callable", "(", "callable_", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kw", ")", ":", "return", "self", ".", "call_and_report_errors", "(", "callable_", ",", "*", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectRules.constant
Declare and set a project global constant. Project global constants are normal variables but should not be changed. They are applied to every child Jamfile.
deps/src/boost_1_68_0/tools/build/src/build/project.py
def constant(self, name, value): """Declare and set a project global constant. Project global constants are normal variables but should not be changed. They are applied to every child Jamfile.""" assert is_iterable_typed(name, basestring) assert is_iterable_typed(value, basestrin...
def constant(self, name, value): """Declare and set a project global constant. Project global constants are normal variables but should not be changed. They are applied to every child Jamfile.""" assert is_iterable_typed(name, basestring) assert is_iterable_typed(value, basestrin...
[ "Declare", "and", "set", "a", "project", "global", "constant", ".", "Project", "global", "constants", "are", "normal", "variables", "but", "should", "not", "be", "changed", ".", "They", "are", "applied", "to", "every", "child", "Jamfile", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L1136-L1142
[ "def", "constant", "(", "self", ",", "name", ",", "value", ")", ":", "assert", "is_iterable_typed", "(", "name", ",", "basestring", ")", "assert", "is_iterable_typed", "(", "value", ",", "basestring", ")", "self", ".", "registry", ".", "current", "(", ")",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectRules.path_constant
Declare and set a project global constant, whose value is a path. The path is adjusted to be relative to the invocation directory. The given value path is taken to be either absolute, or relative to this project root.
deps/src/boost_1_68_0/tools/build/src/build/project.py
def path_constant(self, name, value): """Declare and set a project global constant, whose value is a path. The path is adjusted to be relative to the invocation directory. The given value path is taken to be either absolute, or relative to this project root.""" assert is_iterable...
def path_constant(self, name, value): """Declare and set a project global constant, whose value is a path. The path is adjusted to be relative to the invocation directory. The given value path is taken to be either absolute, or relative to this project root.""" assert is_iterable...
[ "Declare", "and", "set", "a", "project", "global", "constant", "whose", "value", "is", "a", "path", ".", "The", "path", "is", "adjusted", "to", "be", "relative", "to", "the", "invocation", "directory", ".", "The", "given", "value", "path", "is", "taken", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L1144-L1153
[ "def", "path_constant", "(", "self", ",", "name", ",", "value", ")", ":", "assert", "is_iterable_typed", "(", "name", ",", "basestring", ")", "assert", "is_iterable_typed", "(", "value", ",", "basestring", ")", "if", "len", "(", "value", ")", ">", "1", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectRules.conditional
Calculates conditional requirements for multiple requirements at once. This is a shorthand to be reduce duplication and to keep an inline declarative syntax. For example: lib x : x.cpp : [ conditional <toolset>gcc <variant>debug : <define>DEBUG_EXCEPTION <define>DEBUG_TRACE ...
deps/src/boost_1_68_0/tools/build/src/build/project.py
def conditional(self, condition, requirements): """Calculates conditional requirements for multiple requirements at once. This is a shorthand to be reduce duplication and to keep an inline declarative syntax. For example: lib x : x.cpp : [ conditional <toolset>gcc <variant>debug : ...
def conditional(self, condition, requirements): """Calculates conditional requirements for multiple requirements at once. This is a shorthand to be reduce duplication and to keep an inline declarative syntax. For example: lib x : x.cpp : [ conditional <toolset>gcc <variant>debug : ...
[ "Calculates", "conditional", "requirements", "for", "multiple", "requirements", "at", "once", ".", "This", "is", "a", "shorthand", "to", "be", "reduce", "duplication", "and", "to", "keep", "an", "inline", "declarative", "syntax", ".", "For", "example", ":" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L1262-L1276
[ "def", "conditional", "(", "self", ",", "condition", ",", "requirements", ")", ":", "assert", "is_iterable_typed", "(", "condition", ",", "basestring", ")", "assert", "is_iterable_typed", "(", "requirements", ",", "basestring", ")", "c", "=", "string", ".", "j...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create_array_feature_extractor
Creates a feature extractor from an input array feature, return input_features is a list of one (name, array) tuple. extract_indices is either an integer or a list. If it's an integer, the output type is by default a double (but may also be an integer). If a list, the output type is an array.
src/external/coremltools_wrap/coremltools/coremltools/models/array_feature_extractor.py
def create_array_feature_extractor(input_features, output_name, extract_indices, output_type = None): """ Creates a feature extractor from an input array feature, return input_features is a list of one (name, array) tuple. extract_indices is either an integer or a li...
def create_array_feature_extractor(input_features, output_name, extract_indices, output_type = None): """ Creates a feature extractor from an input array feature, return input_features is a list of one (name, array) tuple. extract_indices is either an integer or a li...
[ "Creates", "a", "feature", "extractor", "from", "an", "input", "array", "feature", "return" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/array_feature_extractor.py#L16-L59
[ "def", "create_array_feature_extractor", "(", "input_features", ",", "output_name", ",", "extract_indices", ",", "output_type", "=", "None", ")", ":", "# Make sure that our starting stuff is in the proper form.", "assert", "len", "(", "input_features", ")", "==", "1", "as...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
BuildOutputProcessor.add_input
Add a single build XML output file to our data.
deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py
def add_input(self, input): ''' Add a single build XML output file to our data. ''' events = xml.dom.pulldom.parse(input) context = [] for (event,node) in events: if event == xml.dom.pulldom.START_ELEMENT: context.append(node) i...
def add_input(self, input): ''' Add a single build XML output file to our data. ''' events = xml.dom.pulldom.parse(input) context = [] for (event,node) in events: if event == xml.dom.pulldom.START_ELEMENT: context.append(node) i...
[ "Add", "a", "single", "build", "XML", "output", "file", "to", "our", "data", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py#L85-L103
[ "def", "add_input", "(", "self", ",", "input", ")", ":", "events", "=", "xml", ".", "dom", ".", "pulldom", ".", "parse", "(", "input", ")", "context", "=", "[", "]", "for", "(", "event", ",", "node", ")", "in", "events", ":", "if", "event", "==",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
BuildOutputProcessor.x_build_targets_target
Process the target dependency DAG into an ancestry tree so we can look up which top-level library and test targets specific build actions correspond to.
deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py
def x_build_targets_target( self, node ): ''' Process the target dependency DAG into an ancestry tree so we can look up which top-level library and test targets specific build actions correspond to. ''' target_node = node name = self.get_child_data(target_node,tag='name',...
def x_build_targets_target( self, node ): ''' Process the target dependency DAG into an ancestry tree so we can look up which top-level library and test targets specific build actions correspond to. ''' target_node = node name = self.get_child_data(target_node,tag='name',...
[ "Process", "the", "target", "dependency", "DAG", "into", "an", "ancestry", "tree", "so", "we", "can", "look", "up", "which", "top", "-", "level", "library", "and", "test", "targets", "specific", "build", "actions", "correspond", "to", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py#L146-L167
[ "def", "x_build_targets_target", "(", "self", ",", "node", ")", ":", "target_node", "=", "node", "name", "=", "self", ".", "get_child_data", "(", "target_node", ",", "tag", "=", "'name'", ",", "strip", "=", "True", ")", "path", "=", "self", ".", "get_chi...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
BuildOutputProcessor.x_build_action
Given a build action log, process into the corresponding test log and specific test log sub-part.
deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py
def x_build_action( self, node ): ''' Given a build action log, process into the corresponding test log and specific test log sub-part. ''' action_node = node name = self.get_child(action_node,tag='name') if name: name = self.get_data(name) ...
def x_build_action( self, node ): ''' Given a build action log, process into the corresponding test log and specific test log sub-part. ''' action_node = node name = self.get_child(action_node,tag='name') if name: name = self.get_data(name) ...
[ "Given", "a", "build", "action", "log", "process", "into", "the", "corresponding", "test", "log", "and", "specific", "test", "log", "sub", "-", "part", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py#L169-L233
[ "def", "x_build_action", "(", "self", ",", "node", ")", ":", "action_node", "=", "node", "name", "=", "self", ".", "get_child", "(", "action_node", ",", "tag", "=", "'name'", ")", "if", "name", ":", "name", "=", "self", ".", "get_data", "(", "name", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
BuildOutputProcessor.x_build_timestamp
The time-stamp goes to the corresponding attribute in the result.
deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py
def x_build_timestamp( self, node ): ''' The time-stamp goes to the corresponding attribute in the result. ''' self.timestamps.append(self.get_data(node).strip()) return None
def x_build_timestamp( self, node ): ''' The time-stamp goes to the corresponding attribute in the result. ''' self.timestamps.append(self.get_data(node).strip()) return None
[ "The", "time", "-", "stamp", "goes", "to", "the", "corresponding", "attribute", "in", "the", "result", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py#L235-L240
[ "def", "x_build_timestamp", "(", "self", ",", "node", ")", ":", "self", ".", "timestamps", ".", "append", "(", "self", ".", "get_data", "(", "node", ")", ".", "strip", "(", ")", ")", "return", "None" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
BuildConsoleSummaryReport.print_action
Print the detailed info of failed or always print tests.
deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py
def print_action(self, test_succeed, action): ''' Print the detailed info of failed or always print tests. ''' #self.info_print(">>> {0}",action.keys()) if not test_succeed or action['info']['always_show_run_output']: output = action['output'].strip() if o...
def print_action(self, test_succeed, action): ''' Print the detailed info of failed or always print tests. ''' #self.info_print(">>> {0}",action.keys()) if not test_succeed or action['info']['always_show_run_output']: output = action['output'].strip() if o...
[ "Print", "the", "detailed", "info", "of", "failed", "or", "always", "print", "tests", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py#L363-L378
[ "def", "print_action", "(", "self", ",", "test_succeed", ",", "action", ")", ":", "#self.info_print(\">>> {0}\",action.keys())", "if", "not", "test_succeed", "or", "action", "[", "'info'", "]", "[", "'always_show_run_output'", "]", ":", "output", "=", "action", "[...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_get_weight_param_summary
Get a summary of _NeuralNetwork_pb2.WeightParams Args: wp : _NeuralNetwork_pb2.WeightParams - the _NeuralNetwork_pb2.WeightParams message to display Returns: a str summary for wp
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/printer.py
def _get_weight_param_summary(wp): """Get a summary of _NeuralNetwork_pb2.WeightParams Args: wp : _NeuralNetwork_pb2.WeightParams - the _NeuralNetwork_pb2.WeightParams message to display Returns: a str summary for wp """ summary_str = '' if wp.HasField('quantization'): nbits = wp...
def _get_weight_param_summary(wp): """Get a summary of _NeuralNetwork_pb2.WeightParams Args: wp : _NeuralNetwork_pb2.WeightParams - the _NeuralNetwork_pb2.WeightParams message to display Returns: a str summary for wp """ summary_str = '' if wp.HasField('quantization'): nbits = wp...
[ "Get", "a", "summary", "of", "_NeuralNetwork_pb2", ".", "WeightParams", "Args", ":", "wp", ":", "_NeuralNetwork_pb2", ".", "WeightParams", "-", "the", "_NeuralNetwork_pb2", ".", "WeightParams", "message", "to", "display", "Returns", ":", "a", "str", "summary", "...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/printer.py#L8-L28
[ "def", "_get_weight_param_summary", "(", "wp", ")", ":", "summary_str", "=", "''", "if", "wp", ".", "HasField", "(", "'quantization'", ")", ":", "nbits", "=", "wp", ".", "quantization", ".", "numberOfBits", "quant_type", "=", "'linearly'", "if", "wp", ".", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_summarize_network_layer_info
Args: layer - an MLModel NeuralNetwork Layer protobuf message Returns: layer_type : str - type of layer layer_name : str - name of the layer layer_inputs : list[str] - a list of strings representing input blobs of the layer layer_outputs : list[str] - a list of strings representing output blobs ...
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/printer.py
def _summarize_network_layer_info(layer): """ Args: layer - an MLModel NeuralNetwork Layer protobuf message Returns: layer_type : str - type of layer layer_name : str - name of the layer layer_inputs : list[str] - a list of strings representing input blobs of the layer layer_outputs : li...
def _summarize_network_layer_info(layer): """ Args: layer - an MLModel NeuralNetwork Layer protobuf message Returns: layer_type : str - type of layer layer_name : str - name of the layer layer_inputs : list[str] - a list of strings representing input blobs of the layer layer_outputs : li...
[ "Args", ":", "layer", "-", "an", "MLModel", "NeuralNetwork", "Layer", "protobuf", "message", "Returns", ":", "layer_type", ":", "str", "-", "type", "of", "layer", "layer_name", ":", "str", "-", "name", "of", "the", "layer", "layer_inputs", ":", "list", "["...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/printer.py#L67-L102
[ "def", "_summarize_network_layer_info", "(", "layer", ")", ":", "layer_type_str", "=", "layer", ".", "WhichOneof", "(", "'layer'", ")", "layer_name", "=", "layer", ".", "name", "layer_inputs", "=", "list", "(", "layer", ".", "input", ")", "layer_outputs", "=",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
summarize_neural_network_spec
Summarize network into the following structure. Args: mlmodel_spec : mlmodel spec Returns: inputs : list[(str, str)] - a list of two tuple (name, descriptor) for each input blob. outputs : list[(str, str)] - a list of two tuple (name, descriptor) for each output blob layers : list[(str, list[str...
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/printer.py
def summarize_neural_network_spec(mlmodel_spec): """ Summarize network into the following structure. Args: mlmodel_spec : mlmodel spec Returns: inputs : list[(str, str)] - a list of two tuple (name, descriptor) for each input blob. outputs : list[(str, str)] - a list of two tuple (name, descript...
def summarize_neural_network_spec(mlmodel_spec): """ Summarize network into the following structure. Args: mlmodel_spec : mlmodel spec Returns: inputs : list[(str, str)] - a list of two tuple (name, descriptor) for each input blob. outputs : list[(str, str)] - a list of two tuple (name, descript...
[ "Summarize", "network", "into", "the", "following", "structure", ".", "Args", ":", "mlmodel_spec", ":", "mlmodel", "spec", "Returns", ":", "inputs", ":", "list", "[", "(", "str", "str", ")", "]", "-", "a", "list", "of", "two", "tuple", "(", "name", "de...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/printer.py#L105-L127
[ "def", "summarize_neural_network_spec", "(", "mlmodel_spec", ")", ":", "inputs", "=", "[", "(", "blob", ".", "name", ",", "_get_feature_description_summary", "(", "blob", ")", ")", "for", "blob", "in", "mlmodel_spec", ".", "description", ".", "input", "]", "ou...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
print_network_spec
Print the network information summary. Args: mlmodel_spec : the mlmodel spec interface_only : Shows only the input and output of the network
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/printer.py
def print_network_spec(mlmodel_spec, interface_only=False): """ Print the network information summary. Args: mlmodel_spec : the mlmodel spec interface_only : Shows only the input and output of the network """ inputs, outputs, layers_info = summarize_neural_network_spec(mlmodel_spec) print('...
def print_network_spec(mlmodel_spec, interface_only=False): """ Print the network information summary. Args: mlmodel_spec : the mlmodel spec interface_only : Shows only the input and output of the network """ inputs, outputs, layers_info = summarize_neural_network_spec(mlmodel_spec) print('...
[ "Print", "the", "network", "information", "summary", ".", "Args", ":", "mlmodel_spec", ":", "the", "mlmodel", "spec", "interface_only", ":", "Shows", "only", "the", "input", "and", "output", "of", "the", "network" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/printer.py#L130-L163
[ "def", "print_network_spec", "(", "mlmodel_spec", ",", "interface_only", "=", "False", ")", ":", "inputs", ",", "outputs", ",", "layers_info", "=", "summarize_neural_network_spec", "(", "mlmodel_spec", ")", "print", "(", "'Inputs:'", ")", "for", "i", "in", "inpu...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_generate_base_svm_classifier_spec
Takes an SVM classifier produces a starting spec using the parts. that are shared between all SVMs.
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_SVC.py
def _generate_base_svm_classifier_spec(model): """ Takes an SVM classifier produces a starting spec using the parts. that are shared between all SVMs. """ if not(_HAS_SKLEARN): raise RuntimeError('scikit-learn not found. scikit-learn conversion API is disabled.') check_fitted(model, la...
def _generate_base_svm_classifier_spec(model): """ Takes an SVM classifier produces a starting spec using the parts. that are shared between all SVMs. """ if not(_HAS_SKLEARN): raise RuntimeError('scikit-learn not found. scikit-learn conversion API is disabled.') check_fitted(model, la...
[ "Takes", "an", "SVM", "classifier", "produces", "a", "starting", "spec", "using", "the", "parts", ".", "that", "are", "shared", "between", "all", "SVMs", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_SVC.py#L24-L56
[ "def", "_generate_base_svm_classifier_spec", "(", "model", ")", ":", "if", "not", "(", "_HAS_SKLEARN", ")", ":", "raise", "RuntimeError", "(", "'scikit-learn not found. scikit-learn conversion API is disabled.'", ")", "check_fitted", "(", "model", ",", "lambda", "m", ":...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert
Convert a Support Vector Classtion (SVC) model to the protobuf spec. Parameters ---------- model: SVC A trained SVC encoder model. feature_names: [str], optional (default=None) Name of the input columns. target: str, optional (default=None) Name of the output column. R...
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_SVC.py
def convert(model, feature_names, target): """Convert a Support Vector Classtion (SVC) model to the protobuf spec. Parameters ---------- model: SVC A trained SVC encoder model. feature_names: [str], optional (default=None) Name of the input columns. target: str, optional (defau...
def convert(model, feature_names, target): """Convert a Support Vector Classtion (SVC) model to the protobuf spec. Parameters ---------- model: SVC A trained SVC encoder model. feature_names: [str], optional (default=None) Name of the input columns. target: str, optional (defau...
[ "Convert", "a", "Support", "Vector", "Classtion", "(", "SVC", ")", "model", "to", "the", "protobuf", "spec", ".", "Parameters", "----------", "model", ":", "SVC", "A", "trained", "SVC", "encoder", "model", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_SVC.py#L58-L97
[ "def", "convert", "(", "model", ",", "feature_names", ",", "target", ")", ":", "if", "not", "(", "_HAS_SKLEARN", ")", ":", "raise", "RuntimeError", "(", "'scikit-learn not found. scikit-learn conversion API is disabled.'", ")", "spec", "=", "_generate_base_svm_classifie...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
NetGraph.make_input_layers
Extract the ordering of the input layers.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py
def make_input_layers(self): """ Extract the ordering of the input layers. """ self.input_layers = [] if hasattr(self.model, 'input_layers'): input_keras_layers = self.model.input_layers[:] self.input_layers = [None] * len(input_keras_layers) f...
def make_input_layers(self): """ Extract the ordering of the input layers. """ self.input_layers = [] if hasattr(self.model, 'input_layers'): input_keras_layers = self.model.input_layers[:] self.input_layers = [None] * len(input_keras_layers) f...
[ "Extract", "the", "ordering", "of", "the", "input", "layers", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py#L107-L129
[ "def", "make_input_layers", "(", "self", ")", ":", "self", ".", "input_layers", "=", "[", "]", "if", "hasattr", "(", "self", ".", "model", ",", "'input_layers'", ")", ":", "input_keras_layers", "=", "self", ".", "model", ".", "input_layers", "[", ":", "]...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
NetGraph.make_output_layers
Extract the ordering of output layers.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py
def make_output_layers(self): """ Extract the ordering of output layers. """ # TODO # use successors == 0 as the criteria for output layer # will fail when some intermediate layers also generate output. # However, because the possibility of having inserted layers,...
def make_output_layers(self): """ Extract the ordering of output layers. """ # TODO # use successors == 0 as the criteria for output layer # will fail when some intermediate layers also generate output. # However, because the possibility of having inserted layers,...
[ "Extract", "the", "ordering", "of", "output", "layers", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py#L131-L144
[ "def", "make_output_layers", "(", "self", ")", ":", "# TODO", "# use successors == 0 as the criteria for output layer", "# will fail when some intermediate layers also generate output.", "# However, because the possibility of having inserted layers,", "# it's more difficult to tell which layer i...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
NetGraph.generate_blob_names
Generate blob names for each one of the edge. At this time, Keras does not support "fork" operation (a layer with more than 1 blob output). So we just use names of the src layer to identify a blob. We also assume all neural networks are singly-connected graphs - which should be the case.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py
def generate_blob_names(self): """ Generate blob names for each one of the edge. At this time, Keras does not support "fork" operation (a layer with more than 1 blob output). So we just use names of the src layer to identify a blob. We also assume all neural networks are singly...
def generate_blob_names(self): """ Generate blob names for each one of the edge. At this time, Keras does not support "fork" operation (a layer with more than 1 blob output). So we just use names of the src layer to identify a blob. We also assume all neural networks are singly...
[ "Generate", "blob", "names", "for", "each", "one", "of", "the", "edge", ".", "At", "this", "time", "Keras", "does", "not", "support", "fork", "operation", "(", "a", "layer", "with", "more", "than", "1", "blob", "output", ")", ".", "So", "we", "just", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py#L152-L174
[ "def", "generate_blob_names", "(", "self", ")", ":", "# generate blob names that represent edges in blob_name_map", "# because of the InputLayers, input blobs are also generated.", "# Generate each layer's input / output blob names", "for", "layer", "in", "self", ".", "layer_list", ":"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
NetGraph._remove_layer
remove the layer and its input/output edges
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py
def _remove_layer(self, layer): """ remove the layer and its input/output edges """ successors = self.get_successors(layer) predecessors = self.get_predecessors(layer) # remove all edges for succ in successors: self._remove_edge(layer, succ) fo...
def _remove_layer(self, layer): """ remove the layer and its input/output edges """ successors = self.get_successors(layer) predecessors = self.get_predecessors(layer) # remove all edges for succ in successors: self._remove_edge(layer, succ) fo...
[ "remove", "the", "layer", "and", "its", "input", "/", "output", "edges" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py#L295-L308
[ "def", "_remove_layer", "(", "self", ",", "layer", ")", ":", "successors", "=", "self", ".", "get_successors", "(", "layer", ")", "predecessors", "=", "self", ".", "get_predecessors", "(", "layer", ")", "# remove all edges", "for", "succ", "in", "successors", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
NetGraph._insert_layer_after
Insert the new_layer after layer, whose position is layer_idx. The new layer's parameter is stored in a Keras layer called new_keras_layer
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py
def _insert_layer_after(self, layer_idx, new_layer, new_keras_layer): """ Insert the new_layer after layer, whose position is layer_idx. The new layer's parameter is stored in a Keras layer called new_keras_layer """ # reminder: new_keras_layer is not part of the original Keras n...
def _insert_layer_after(self, layer_idx, new_layer, new_keras_layer): """ Insert the new_layer after layer, whose position is layer_idx. The new layer's parameter is stored in a Keras layer called new_keras_layer """ # reminder: new_keras_layer is not part of the original Keras n...
[ "Insert", "the", "new_layer", "after", "layer", "whose", "position", "is", "layer_idx", ".", "The", "new", "layer", "s", "parameter", "is", "stored", "in", "a", "Keras", "layer", "called", "new_keras_layer" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py#L361-L378
[ "def", "_insert_layer_after", "(", "self", ",", "layer_idx", ",", "new_layer", ",", "new_keras_layer", ")", ":", "# reminder: new_keras_layer is not part of the original Keras network,", "# so it's input / output blob information is missing. It serves only as", "# a parameter holder.", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
NetGraph._insert_layer_between
Insert the new_layer before layer, whose position is layer_idx. The new layer's parameter is stored in a Keras layer called new_keras_layer
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py
def _insert_layer_between(self, src, snk, new_layer, new_keras_layer): """ Insert the new_layer before layer, whose position is layer_idx. The new layer's parameter is stored in a Keras layer called new_keras_layer """ if snk is None: insert_pos = self.layer_list.inde...
def _insert_layer_between(self, src, snk, new_layer, new_keras_layer): """ Insert the new_layer before layer, whose position is layer_idx. The new layer's parameter is stored in a Keras layer called new_keras_layer """ if snk is None: insert_pos = self.layer_list.inde...
[ "Insert", "the", "new_layer", "before", "layer", "whose", "position", "is", "layer_idx", ".", "The", "new", "layer", "s", "parameter", "is", "stored", "in", "a", "Keras", "layer", "called", "new_keras_layer" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py#L380-L398
[ "def", "_insert_layer_between", "(", "self", ",", "src", ",", "snk", ",", "new_layer", ",", "new_keras_layer", ")", ":", "if", "snk", "is", "None", ":", "insert_pos", "=", "self", ".", "layer_list", ".", "index", "(", "src", ")", "+", "1", "else", ":",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
NetGraph.defuse_activation
Defuse the fused activation layers in the network.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py
def defuse_activation(self): """ Defuse the fused activation layers in the network. """ idx, nb_layers = 0, len(self.layer_list) while idx < nb_layers: layer = self.layer_list[idx] k_layer = self.keras_layer_map[layer] # unwrap time-distributed...
def defuse_activation(self): """ Defuse the fused activation layers in the network. """ idx, nb_layers = 0, len(self.layer_list) while idx < nb_layers: layer = self.layer_list[idx] k_layer = self.keras_layer_map[layer] # unwrap time-distributed...
[ "Defuse", "the", "fused", "activation", "layers", "in", "the", "network", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py#L400-L430
[ "def", "defuse_activation", "(", "self", ")", ":", "idx", ",", "nb_layers", "=", "0", ",", "len", "(", "self", ".", "layer_list", ")", "while", "idx", "<", "nb_layers", ":", "layer", "=", "self", ".", "layer_list", "[", "idx", "]", "k_layer", "=", "s...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
NetGraph._get_1d_interface_edges
Get edges that represents transition from not 1D to 1D, and 1D to not 1D A 'in_edge e(u,v)' means u operates on non-1D blobs, but v operates on 1D blobs. An 'out_edge e(u,v)' means u operates on 1D blobs, but v operates on non-1D blobs.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py
def _get_1d_interface_edges(self): """ Get edges that represents transition from not 1D to 1D, and 1D to not 1D A 'in_edge e(u,v)' means u operates on non-1D blobs, but v operates on 1D blobs. An 'out_edge e(u,v)' means u operates on 1D blobs, but v operates on non-1D blobs. """ ...
def _get_1d_interface_edges(self): """ Get edges that represents transition from not 1D to 1D, and 1D to not 1D A 'in_edge e(u,v)' means u operates on non-1D blobs, but v operates on 1D blobs. An 'out_edge e(u,v)' means u operates on 1D blobs, but v operates on non-1D blobs. """ ...
[ "Get", "edges", "that", "represents", "transition", "from", "not", "1D", "to", "1D", "and", "1D", "to", "not", "1D", "A", "in_edge", "e", "(", "u", "v", ")", "means", "u", "operates", "on", "non", "-", "1D", "blobs", "but", "v", "operates", "on", "...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py#L446-L490
[ "def", "_get_1d_interface_edges", "(", "self", ")", ":", "in_edges", "=", "[", "]", "for", "layer", "in", "self", ".", "layer_list", ":", "if", "not", "self", ".", "is_1d_layer", "(", "layer", ")", ":", "continue", "preds", "=", "self", ".", "get_predece...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
NetGraph.insert_1d_permute_layers
Insert permutation layers before a 1D start point or after 1D end point
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py
def insert_1d_permute_layers(self): """ Insert permutation layers before a 1D start point or after 1D end point """ idx, nb_layers = 0, len(self.layer_list) in_edges, out_edges = self._get_1d_interface_edges() # Hacky Warning: (1) use a 4-D permute, which is not likely t...
def insert_1d_permute_layers(self): """ Insert permutation layers before a 1D start point or after 1D end point """ idx, nb_layers = 0, len(self.layer_list) in_edges, out_edges = self._get_1d_interface_edges() # Hacky Warning: (1) use a 4-D permute, which is not likely t...
[ "Insert", "permutation", "layers", "before", "a", "1D", "start", "point", "or", "after", "1D", "end", "point" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py#L492-L518
[ "def", "insert_1d_permute_layers", "(", "self", ")", ":", "idx", ",", "nb_layers", "=", "0", ",", "len", "(", "self", ".", "layer_list", ")", "in_edges", ",", "out_edges", "=", "self", ".", "_get_1d_interface_edges", "(", ")", "# Hacky Warning: (1) use a 4-D per...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
replace_nodes
Replace the old node with the new one. Old must be an indirect child of root :param root: ast node that contains an indirect reference to old :param old: node to replace :param new: node to replace `old` with
src/unity/python/turicreate/meta/asttools/mutators/replace_mutator.py
def replace_nodes(root, old, new): ''' Replace the old node with the new one. Old must be an indirect child of root :param root: ast node that contains an indirect reference to old :param old: node to replace :param new: node to replace `old` with ''' rep = Replacer(old, new) ...
def replace_nodes(root, old, new): ''' Replace the old node with the new one. Old must be an indirect child of root :param root: ast node that contains an indirect reference to old :param old: node to replace :param new: node to replace `old` with ''' rep = Replacer(old, new) ...
[ "Replace", "the", "old", "node", "with", "the", "new", "one", ".", "Old", "must", "be", "an", "indirect", "child", "of", "root", ":", "param", "root", ":", "ast", "node", "that", "contains", "an", "indirect", "reference", "to", "old", ":", "param", "ol...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/asttools/mutators/replace_mutator.py#L49-L62
[ "def", "replace_nodes", "(", "root", ",", "old", ",", "new", ")", ":", "rep", "=", "Replacer", "(", "old", ",", "new", ")", "rep", ".", "visit", "(", "root", ")", "return" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
log_component_configuration
Report something about component configuration that the user should better know.
deps/src/boost_1_68_0/tools/build/src/build/configure.py
def log_component_configuration(component, message): """Report something about component configuration that the user should better know.""" assert isinstance(component, basestring) assert isinstance(message, basestring) __component_logs.setdefault(component, []).append(message)
def log_component_configuration(component, message): """Report something about component configuration that the user should better know.""" assert isinstance(component, basestring) assert isinstance(message, basestring) __component_logs.setdefault(component, []).append(message)
[ "Report", "something", "about", "component", "configuration", "that", "the", "user", "should", "better", "know", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/configure.py#L52-L56
[ "def", "log_component_configuration", "(", "component", ",", "message", ")", ":", "assert", "isinstance", "(", "component", ",", "basestring", ")", "assert", "isinstance", "(", "message", ",", "basestring", ")", "__component_logs", ".", "setdefault", "(", "compone...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create
Create a Transformer object to transform data for feature engineering. Parameters ---------- dataset : SFrame The dataset to use for training the model. transformers: Transformer | list[Transformer] An Transformer or a list of Transformers. See Also -------- turicreate.to...
src/unity/python/turicreate/toolkits/_feature_engineering/__init__.py
def create(dataset, transformers): """ Create a Transformer object to transform data for feature engineering. Parameters ---------- dataset : SFrame The dataset to use for training the model. transformers: Transformer | list[Transformer] An Transformer or a list of Transformer...
def create(dataset, transformers): """ Create a Transformer object to transform data for feature engineering. Parameters ---------- dataset : SFrame The dataset to use for training the model. transformers: Transformer | list[Transformer] An Transformer or a list of Transformer...
[ "Create", "a", "Transformer", "object", "to", "transform", "data", "for", "feature", "engineering", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/__init__.py#L47-L106
[ "def", "create", "(", "dataset", ",", "transformers", ")", ":", "err_msg", "=", "\"The parameters 'transformers' must be a valid Transformer object.\"", "cls", "=", "transformers", ".", "__class__", "_raise_error_if_not_sframe", "(", "dataset", ",", "\"dataset\"", ")", "#...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
VGGishFeatureExtractor._preprocess_data
Preprocess each example, breaking it up into frames. Returns two numpy arrays: preprocessed frame and their indexes
src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py
def _preprocess_data(audio_data, verbose=True): ''' Preprocess each example, breaking it up into frames. Returns two numpy arrays: preprocessed frame and their indexes ''' from .vggish_input import waveform_to_examples last_progress_update = _time.time() progres...
def _preprocess_data(audio_data, verbose=True): ''' Preprocess each example, breaking it up into frames. Returns two numpy arrays: preprocessed frame and their indexes ''' from .vggish_input import waveform_to_examples last_progress_update = _time.time() progres...
[ "Preprocess", "each", "example", "breaking", "it", "up", "into", "frames", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py#L40-L72
[ "def", "_preprocess_data", "(", "audio_data", ",", "verbose", "=", "True", ")", ":", "from", ".", "vggish_input", "import", "waveform_to_examples", "last_progress_update", "=", "_time", ".", "time", "(", ")", "progress_header_printed", "=", "False", "# Can't run as ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
VGGishFeatureExtractor._extract_features
Parameters ---------- preprocessed_data : SArray Returns ------- numpy array containing the deep features
src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py
def _extract_features(self, preprocessed_data, verbose=True): """ Parameters ---------- preprocessed_data : SArray Returns ------- numpy array containing the deep features """ last_progress_update = _time.time() progress_header_printed = F...
def _extract_features(self, preprocessed_data, verbose=True): """ Parameters ---------- preprocessed_data : SArray Returns ------- numpy array containing the deep features """ last_progress_update = _time.time() progress_header_printed = F...
[ "Parameters", "----------", "preprocessed_data", ":", "SArray" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py#L112-L170
[ "def", "_extract_features", "(", "self", ",", "preprocessed_data", ",", "verbose", "=", "True", ")", ":", "last_progress_update", "=", "_time", ".", "time", "(", ")", "progress_header_printed", "=", "False", "deep_features", "=", "_tc", ".", "SArrayBuilder", "("...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
VGGishFeatureExtractor.get_deep_features
Performs both audio preprocessing and VGGish deep feature extraction.
src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py
def get_deep_features(self, audio_data, verbose): ''' Performs both audio preprocessing and VGGish deep feature extraction. ''' preprocessed_data, row_ids = self._preprocess_data(audio_data, verbose) deep_features = self._extract_features(preprocessed_data, verbose) outp...
def get_deep_features(self, audio_data, verbose): ''' Performs both audio preprocessing and VGGish deep feature extraction. ''' preprocessed_data, row_ids = self._preprocess_data(audio_data, verbose) deep_features = self._extract_features(preprocessed_data, verbose) outp...
[ "Performs", "both", "audio", "preprocessing", "and", "VGGish", "deep", "feature", "extraction", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py#L172-L190
[ "def", "get_deep_features", "(", "self", ",", "audio_data", ",", "verbose", ")", ":", "preprocessed_data", ",", "row_ids", "=", "self", ".", "_preprocess_data", "(", "audio_data", ",", "verbose", ")", "deep_features", "=", "self", ".", "_extract_features", "(", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
VGGishFeatureExtractor.get_spec
Return the Core ML spec
src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py
def get_spec(self): """ Return the Core ML spec """ if _mac_ver() >= (10, 14): return self.vggish_model.get_spec() else: vggish_model_file = VGGish() coreml_model_path = vggish_model_file.get_model_path(format='coreml') return MLMod...
def get_spec(self): """ Return the Core ML spec """ if _mac_ver() >= (10, 14): return self.vggish_model.get_spec() else: vggish_model_file = VGGish() coreml_model_path = vggish_model_file.get_model_path(format='coreml') return MLMod...
[ "Return", "the", "Core", "ML", "spec" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py#L192-L201
[ "def", "get_spec", "(", "self", ")", ":", "if", "_mac_ver", "(", ")", ">=", "(", "10", ",", "14", ")", ":", "return", "self", ".", "vggish_model", ".", "get_spec", "(", ")", "else", ":", "vggish_model_file", "=", "VGGish", "(", ")", "coreml_model_path"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
remove_trivial
Remove redundant statements. The statement `a = 1` will be removed:: a = 1 a = 2 The statement `a = 1` will not be removed because `b` depends on it:: a = 1 b = a + 2 a = 2 :param root: ast node
src/unity/python/turicreate/meta/asttools/mutators/remove_trivial.py
def remove_trivial(root): ''' Remove redundant statements. The statement `a = 1` will be removed:: a = 1 a = 2 The statement `a = 1` will not be removed because `b` depends on it:: a = 1 b = a + 2 a = 2 :param root: ast node ...
def remove_trivial(root): ''' Remove redundant statements. The statement `a = 1` will be removed:: a = 1 a = 2 The statement `a = 1` will not be removed because `b` depends on it:: a = 1 b = a + 2 a = 2 :param root: ast node ...
[ "Remove", "redundant", "statements", ".", "The", "statement", "a", "=", "1", "will", "be", "removed", "::", "a", "=", "1", "a", "=", "2" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/asttools/mutators/remove_trivial.py#L78-L120
[ "def", "remove_trivial", "(", "root", ")", ":", "gen", "=", "GatherAssignments", "(", ")", "gen", ".", "visit", "(", "root", ")", "to_remove", "=", "[", "]", "for", "symbol", ",", "assignments", "in", "gen", ".", "assign_id_map", ".", "items", "(", ")"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
safe_isinstance
To prevent circular imports, this extends isinstance() by checking also if `value` has a particular class name (or inherits from a particular class name). This check is safe in that an AttributeError is not raised in case `value` doesn't have a __class__ attribute.
deps/src/boost_1_68_0/tools/build/src/util/__init__.py
def safe_isinstance(value, types=None, class_names=None): """To prevent circular imports, this extends isinstance() by checking also if `value` has a particular class name (or inherits from a particular class name). This check is safe in that an AttributeError is not raised in case `value` doesn't have ...
def safe_isinstance(value, types=None, class_names=None): """To prevent circular imports, this extends isinstance() by checking also if `value` has a particular class name (or inherits from a particular class name). This check is safe in that an AttributeError is not raised in case `value` doesn't have ...
[ "To", "prevent", "circular", "imports", "this", "extends", "isinstance", "()", "by", "checking", "also", "if", "value", "has", "a", "particular", "class", "name", "(", "or", "inherits", "from", "a", "particular", "class", "name", ")", ".", "This", "check", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/__init__.py#L9-L36
[ "def", "safe_isinstance", "(", "value", ",", "types", "=", "None", ",", "class_names", "=", "None", ")", ":", "# inspect is being imported here because I seriously doubt", "# that this function will be used outside of the type", "# checking below.", "import", "inspect", "result...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
value_to_jam
Makes a token to refer to a Python value inside Jam language code. The token is merely a string that can be passed around in Jam code and eventually passed back. For example, we might want to pass PropertySet instance to a tag function and it might eventually call back to virtual_target.add_suffix_and_...
deps/src/boost_1_68_0/tools/build/src/util/__init__.py
def value_to_jam(value, methods=False): """Makes a token to refer to a Python value inside Jam language code. The token is merely a string that can be passed around in Jam code and eventually passed back. For example, we might want to pass PropertySet instance to a tag function and it might eventually ...
def value_to_jam(value, methods=False): """Makes a token to refer to a Python value inside Jam language code. The token is merely a string that can be passed around in Jam code and eventually passed back. For example, we might want to pass PropertySet instance to a tag function and it might eventually ...
[ "Makes", "a", "token", "to", "refer", "to", "a", "Python", "value", "inside", "Jam", "language", "code", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/__init__.py#L228-L261
[ "def", "value_to_jam", "(", "value", ",", "methods", "=", "False", ")", ":", "global", "__value_id", "r", "=", "__python_to_jam", ".", "get", "(", "value", ",", "None", ")", "if", "r", ":", "return", "r", "exported_name", "=", "'###_'", "+", "str", "("...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
abbreviate_dashed
Abbreviates each part of string that is delimited by a '-'.
deps/src/boost_1_68_0/tools/build/src/util/__init__.py
def abbreviate_dashed(s): """Abbreviates each part of string that is delimited by a '-'.""" r = [] for part in s.split('-'): r.append(abbreviate(part)) return '-'.join(r)
def abbreviate_dashed(s): """Abbreviates each part of string that is delimited by a '-'.""" r = [] for part in s.split('-'): r.append(abbreviate(part)) return '-'.join(r)
[ "Abbreviates", "each", "part", "of", "string", "that", "is", "delimited", "by", "a", "-", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/__init__.py#L281-L286
[ "def", "abbreviate_dashed", "(", "s", ")", ":", "r", "=", "[", "]", "for", "part", "in", "s", ".", "split", "(", "'-'", ")", ":", "r", ".", "append", "(", "abbreviate", "(", "part", ")", ")", "return", "'-'", ".", "join", "(", "r", ")" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
abbreviate
Apply a set of standard transformations to string to produce an abbreviation no more than 4 characters long.
deps/src/boost_1_68_0/tools/build/src/util/__init__.py
def abbreviate(s): """Apply a set of standard transformations to string to produce an abbreviation no more than 4 characters long. """ if not s: return '' # check the cache if s in abbreviate.abbreviations: return abbreviate.abbreviations[s] # anything less than 4 characters ...
def abbreviate(s): """Apply a set of standard transformations to string to produce an abbreviation no more than 4 characters long. """ if not s: return '' # check the cache if s in abbreviate.abbreviations: return abbreviate.abbreviations[s] # anything less than 4 characters ...
[ "Apply", "a", "set", "of", "standard", "transformations", "to", "string", "to", "produce", "an", "abbreviation", "no", "more", "than", "4", "characters", "long", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/__init__.py#L289-L319
[ "def", "abbreviate", "(", "s", ")", ":", "if", "not", "s", ":", "return", "''", "# check the cache", "if", "s", "in", "abbreviate", ".", "abbreviations", ":", "return", "abbreviate", ".", "abbreviations", "[", "s", "]", "# anything less than 4 characters doesn't...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Node.get_decision
Get the decision from this node to a child node. Parameters ---------- child: Node A child node of this node. Returns ------- dict: A dictionary that describes how to get from this node to the child node.
src/unity/python/turicreate/toolkits/_decision_tree.py
def get_decision(self, child, is_missing = False): """ Get the decision from this node to a child node. Parameters ---------- child: Node A child node of this node. Returns ------- dict: A dictionary that describes how to get from this node t...
def get_decision(self, child, is_missing = False): """ Get the decision from this node to a child node. Parameters ---------- child: Node A child node of this node. Returns ------- dict: A dictionary that describes how to get from this node t...
[ "Get", "the", "decision", "from", "this", "node", "to", "a", "child", "node", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_decision_tree.py#L80-L123
[ "def", "get_decision", "(", "self", ",", "child", ",", "is_missing", "=", "False", ")", ":", "# Child does exist and there is a path to the child.", "value", "=", "self", ".", "value", "feature", "=", "self", ".", "split_feature_column", "index", "=", "self", ".",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Node.to_dict
Return the node as a dictionary. Returns ------- dict: All the attributes of this node as a dictionary (minus the left and right).
src/unity/python/turicreate/toolkits/_decision_tree.py
def to_dict(self): """ Return the node as a dictionary. Returns ------- dict: All the attributes of this node as a dictionary (minus the left and right). """ out = {} for key in self.__dict__.keys(): if key not in ['left', 'right...
def to_dict(self): """ Return the node as a dictionary. Returns ------- dict: All the attributes of this node as a dictionary (minus the left and right). """ out = {} for key in self.__dict__.keys(): if key not in ['left', 'right...
[ "Return", "the", "node", "as", "a", "dictionary", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_decision_tree.py#L125-L138
[ "def", "to_dict", "(", "self", ")", ":", "out", "=", "{", "}", "for", "key", "in", "self", ".", "__dict__", ".", "keys", "(", ")", ":", "if", "key", "not", "in", "[", "'left'", ",", "'right'", ",", "'missing'", ",", "'parent'", "]", ":", "out", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DecisionTree.to_json
Recursive function to dump this tree as a json blob. Parameters ---------- root_id: Root id of the sub-tree output: Carry over output from the previous sub-trees. Returns ------- dict: A tree in JSON format. Starts at the root node and recursively repres...
src/unity/python/turicreate/toolkits/_decision_tree.py
def to_json(self, root_id = 0, output = {}): """ Recursive function to dump this tree as a json blob. Parameters ---------- root_id: Root id of the sub-tree output: Carry over output from the previous sub-trees. Returns ------- dict: A tree in JS...
def to_json(self, root_id = 0, output = {}): """ Recursive function to dump this tree as a json blob. Parameters ---------- root_id: Root id of the sub-tree output: Carry over output from the previous sub-trees. Returns ------- dict: A tree in JS...
[ "Recursive", "function", "to", "dump", "this", "tree", "as", "a", "json", "blob", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_decision_tree.py#L300-L371
[ "def", "to_json", "(", "self", ",", "root_id", "=", "0", ",", "output", "=", "{", "}", ")", ":", "_raise_error_if_not_of_type", "(", "root_id", ",", "[", "int", ",", "long", "]", ",", "\"root_id\"", ")", "_numeric_param_check_range", "(", "\"root_id\"", ",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DecisionTree.get_prediction_score
Return the prediction score (if leaf node) or None if its an intermediate node. Parameters ---------- node_id: id of the node to get the prediction value. Returns ------- float or None: returns float value of prediction if leaf node and None if not. ...
src/unity/python/turicreate/toolkits/_decision_tree.py
def get_prediction_score(self, node_id): """ Return the prediction score (if leaf node) or None if its an intermediate node. Parameters ---------- node_id: id of the node to get the prediction value. Returns ------- float or None: returns float v...
def get_prediction_score(self, node_id): """ Return the prediction score (if leaf node) or None if its an intermediate node. Parameters ---------- node_id: id of the node to get the prediction value. Returns ------- float or None: returns float v...
[ "Return", "the", "prediction", "score", "(", "if", "leaf", "node", ")", "or", "None", "if", "its", "an", "intermediate", "node", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_decision_tree.py#L373-L401
[ "def", "get_prediction_score", "(", "self", ",", "node_id", ")", ":", "_raise_error_if_not_of_type", "(", "node_id", ",", "[", "int", ",", "long", "]", ",", "\"node_id\"", ")", "_numeric_param_check_range", "(", "\"node_id\"", ",", "node_id", ",", "0", ",", "s...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
DecisionTree.get_prediction_path
Return the prediction path from this node to the parent node. Parameters ---------- node_id : id of the node to get the prediction path. missing_id : Additional info that contains nodes with missing features. Returns ------- list: The list of decisions (top t...
src/unity/python/turicreate/toolkits/_decision_tree.py
def get_prediction_path(self, node_id, missing_id = []): """ Return the prediction path from this node to the parent node. Parameters ---------- node_id : id of the node to get the prediction path. missing_id : Additional info that contains nodes with missing features...
def get_prediction_path(self, node_id, missing_id = []): """ Return the prediction path from this node to the parent node. Parameters ---------- node_id : id of the node to get the prediction path. missing_id : Additional info that contains nodes with missing features...
[ "Return", "the", "prediction", "path", "from", "this", "node", "to", "the", "parent", "node", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_decision_tree.py#L403-L484
[ "def", "get_prediction_path", "(", "self", ",", "node_id", ",", "missing_id", "=", "[", "]", ")", ":", "_raise_error_if_not_of_type", "(", "node_id", ",", "[", "int", ",", "long", "]", ",", "\"node_id\"", ")", "_numeric_param_check_range", "(", "\"node_id\"", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create
Given a weighted graph with observed class labels of a subset of vertices, infer the label probability for the unobserved vertices using the "label propagation" algorithm. The algorithm iteratively updates the label probability of current vertex as a weighted sum of label probability of self and the ne...
src/unity/python/turicreate/toolkits/graph_analytics/label_propagation.py
def create(graph, label_field, threshold=1e-3, weight_field='', self_weight=1.0, undirected=False, max_iterations=None, _single_precision=False, _distributed='auto', verbose=True): """ Given a weighted graph with observed cl...
def create(graph, label_field, threshold=1e-3, weight_field='', self_weight=1.0, undirected=False, max_iterations=None, _single_precision=False, _distributed='auto', verbose=True): """ Given a weighted graph with observed cl...
[ "Given", "a", "weighted", "graph", "with", "observed", "class", "labels", "of", "a", "subset", "of", "vertices", "infer", "the", "label", "probability", "for", "the", "unobserved", "vertices", "using", "the", "label", "propagation", "algorithm", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/graph_analytics/label_propagation.py#L131-L274
[ "def", "create", "(", "graph", ",", "label_field", ",", "threshold", "=", "1e-3", ",", "weight_field", "=", "''", ",", "self_weight", "=", "1.0", ",", "undirected", "=", "False", ",", "max_iterations", "=", "None", ",", "_single_precision", "=", "False", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_is_not_pickle_safe_gl_model_class
Check if a Turi create model is pickle safe. The function does it by checking that _CustomModel is the base class. Parameters ---------- obj_class : Class to be checked. Returns ---------- True if the GLC class is a model and is pickle safe.
src/unity/python/turicreate/_gl_pickle.py
def _is_not_pickle_safe_gl_model_class(obj_class): """ Check if a Turi create model is pickle safe. The function does it by checking that _CustomModel is the base class. Parameters ---------- obj_class : Class to be checked. Returns ---------- True if the GLC class is a model a...
def _is_not_pickle_safe_gl_model_class(obj_class): """ Check if a Turi create model is pickle safe. The function does it by checking that _CustomModel is the base class. Parameters ---------- obj_class : Class to be checked. Returns ---------- True if the GLC class is a model a...
[ "Check", "if", "a", "Turi", "create", "model", "is", "pickle", "safe", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L33-L50
[ "def", "_is_not_pickle_safe_gl_model_class", "(", "obj_class", ")", ":", "if", "issubclass", "(", "obj_class", ",", "_toolkits", ".", "_model", ".", "CustomModel", ")", ":", "return", "not", "obj_class", ".", "_is_gl_pickle_safe", "(", ")", "return", "False" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_is_not_pickle_safe_gl_class
Check if class is a Turi create model. The function does it by checking the method resolution order (MRO) of the class and verifies that _Model is the base class. Parameters ---------- obj_class : Class to be checked. Returns ---------- True if the class is a GLC Model.
src/unity/python/turicreate/_gl_pickle.py
def _is_not_pickle_safe_gl_class(obj_class): """ Check if class is a Turi create model. The function does it by checking the method resolution order (MRO) of the class and verifies that _Model is the base class. Parameters ---------- obj_class : Class to be checked. Returns ---...
def _is_not_pickle_safe_gl_class(obj_class): """ Check if class is a Turi create model. The function does it by checking the method resolution order (MRO) of the class and verifies that _Model is the base class. Parameters ---------- obj_class : Class to be checked. Returns ---...
[ "Check", "if", "class", "is", "a", "Turi", "create", "model", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L52-L71
[ "def", "_is_not_pickle_safe_gl_class", "(", "obj_class", ")", ":", "gl_ds", "=", "[", "_SFrame", ",", "_SArray", ",", "_SGraph", "]", "# Object is GLC-DS or GLC-Model", "return", "(", "obj_class", "in", "gl_ds", ")", "or", "_is_not_pickle_safe_gl_model_class", "(", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_get_gl_class_type
Internal util to get the type of the GLC class. The pickle file stores this name so that it knows how to construct the object on unpickling. Parameters ---------- obj_class : Class which has to be categorized. Returns ---------- A class type for the pickle file to save.
src/unity/python/turicreate/_gl_pickle.py
def _get_gl_class_type(obj_class): """ Internal util to get the type of the GLC class. The pickle file stores this name so that it knows how to construct the object on unpickling. Parameters ---------- obj_class : Class which has to be categorized. Returns ---------- A class typ...
def _get_gl_class_type(obj_class): """ Internal util to get the type of the GLC class. The pickle file stores this name so that it knows how to construct the object on unpickling. Parameters ---------- obj_class : Class which has to be categorized. Returns ---------- A class typ...
[ "Internal", "util", "to", "get", "the", "type", "of", "the", "GLC", "class", ".", "The", "pickle", "file", "stores", "this", "name", "so", "that", "it", "knows", "how", "to", "construct", "the", "object", "on", "unpickling", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L73-L97
[ "def", "_get_gl_class_type", "(", "obj_class", ")", ":", "if", "obj_class", "==", "_SFrame", ":", "return", "\"SFrame\"", "elif", "obj_class", "==", "_SGraph", ":", "return", "\"SGraph\"", "elif", "obj_class", "==", "_SArray", ":", "return", "\"SArray\"", "elif"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_get_gl_object_from_persistent_id
Internal util to get a GLC object from a persistent ID in the pickle file. Parameters ---------- type_tag : The name of the glc class as saved in the GLC pickler. gl_archive_abs_path: An absolute path to the GLC archive where the object was saved. Returns ---------- ...
src/unity/python/turicreate/_gl_pickle.py
def _get_gl_object_from_persistent_id(type_tag, gl_archive_abs_path): """ Internal util to get a GLC object from a persistent ID in the pickle file. Parameters ---------- type_tag : The name of the glc class as saved in the GLC pickler. gl_archive_abs_path: An absolute path to the GLC archive ...
def _get_gl_object_from_persistent_id(type_tag, gl_archive_abs_path): """ Internal util to get a GLC object from a persistent ID in the pickle file. Parameters ---------- type_tag : The name of the glc class as saved in the GLC pickler. gl_archive_abs_path: An absolute path to the GLC archive ...
[ "Internal", "util", "to", "get", "a", "GLC", "object", "from", "a", "persistent", "ID", "in", "the", "pickle", "file", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L99-L127
[ "def", "_get_gl_object_from_persistent_id", "(", "type_tag", ",", "gl_archive_abs_path", ")", ":", "if", "type_tag", "==", "\"SFrame\"", ":", "obj", "=", "_SFrame", "(", "gl_archive_abs_path", ")", "elif", "type_tag", "==", "\"SGraph\"", ":", "obj", "=", "_load_gr...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
GLPickler.persistent_id
Provide a persistent ID for "saving" GLC objects by reference. Return None for all non GLC objects. Parameters ---------- obj: Name of the object whose persistent ID is extracted. Returns -------- None if the object is not a GLC object. (ClassName, relative pat...
src/unity/python/turicreate/_gl_pickle.py
def persistent_id(self, obj): """ Provide a persistent ID for "saving" GLC objects by reference. Return None for all non GLC objects. Parameters ---------- obj: Name of the object whose persistent ID is extracted. Returns -------- None if the ob...
def persistent_id(self, obj): """ Provide a persistent ID for "saving" GLC objects by reference. Return None for all non GLC objects. Parameters ---------- obj: Name of the object whose persistent ID is extracted. Returns -------- None if the ob...
[ "Provide", "a", "persistent", "ID", "for", "saving", "GLC", "objects", "by", "reference", ".", "Return", "None", "for", "all", "non", "GLC", "objects", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L287-L351
[ "def", "persistent_id", "(", "self", ",", "obj", ")", ":", "# Get the class of the object (if it can be done)", "obj_class", "=", "None", "if", "not", "hasattr", "(", "obj", ",", "'__class__'", ")", "else", "obj", ".", "__class__", "if", "obj_class", "is", "None...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
GLPickler.close
Close the pickle file, and the zip archive file. The single zip archive file can now be shipped around to be loaded by the unpickler.
src/unity/python/turicreate/_gl_pickle.py
def close(self): """ Close the pickle file, and the zip archive file. The single zip archive file can now be shipped around to be loaded by the unpickler. """ if self.file is None: return # Close the pickle file. self.file.close() self.file = ...
def close(self): """ Close the pickle file, and the zip archive file. The single zip archive file can now be shipped around to be loaded by the unpickler. """ if self.file is None: return # Close the pickle file. self.file.close() self.file = ...
[ "Close", "the", "pickle", "file", "and", "the", "zip", "archive", "file", ".", "The", "single", "zip", "archive", "file", "can", "now", "be", "shipped", "around", "to", "be", "loaded", "by", "the", "unpickler", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L353-L374
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "file", "is", "None", ":", "return", "# Close the pickle file.", "self", ".", "file", ".", "close", "(", ")", "self", ".", "file", "=", "None", "for", "f", "in", "self", ".", "mark_for_delete", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
GLUnpickler.persistent_load
Reconstruct a GLC object using the persistent ID. This method should not be used externally. It is required by the unpickler super class. Parameters ---------- pid : The persistent ID used in pickle file to save the GLC object. Returns ---------- The GLC o...
src/unity/python/turicreate/_gl_pickle.py
def persistent_load(self, pid): """ Reconstruct a GLC object using the persistent ID. This method should not be used externally. It is required by the unpickler super class. Parameters ---------- pid : The persistent ID used in pickle file to save the GLC object. ...
def persistent_load(self, pid): """ Reconstruct a GLC object using the persistent ID. This method should not be used externally. It is required by the unpickler super class. Parameters ---------- pid : The persistent ID used in pickle file to save the GLC object. ...
[ "Reconstruct", "a", "GLC", "object", "using", "the", "persistent", "ID", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L472-L500
[ "def", "persistent_load", "(", "self", ",", "pid", ")", ":", "if", "len", "(", "pid", ")", "==", "2", ":", "# Pre GLC-1.3 release behavior, without memorization", "type_tag", ",", "filename", "=", "pid", "abs_path", "=", "_os", ".", "path", ".", "join", "(",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
GLUnpickler.close
Clean up files that were created.
src/unity/python/turicreate/_gl_pickle.py
def close(self): """ Clean up files that were created. """ if self.file: self.file.close() self.file = None # If temp_file is a folder, we do not remove it because we may # still need it after the unpickler is disposed if self.tmp_file and...
def close(self): """ Clean up files that were created. """ if self.file: self.file.close() self.file = None # If temp_file is a folder, we do not remove it because we may # still need it after the unpickler is disposed if self.tmp_file and...
[ "Clean", "up", "files", "that", "were", "created", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L502-L514
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "file", ":", "self", ".", "file", ".", "close", "(", ")", "self", ".", "file", "=", "None", "# If temp_file is a folder, we do not remove it because we may", "# still need it after the unpickler is disposed", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert
Convert scikit-learn pipeline, classifier, or regressor to Core ML format. Parameters ---------- sk_obj: model | [model] of scikit-learn format. Scikit learn model(s) to convert to a Core ML format. The input model may be a single scikit learn model, a scikit learn pipeline model, ...
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_converter.py
def convert(sk_obj, input_features = None, output_feature_names = None): """ Convert scikit-learn pipeline, classifier, or regressor to Core ML format. Parameters ---------- sk_obj: model | [model] of scikit-learn format. Scikit learn model(s) to convert to a Core ML format. ...
def convert(sk_obj, input_features = None, output_feature_names = None): """ Convert scikit-learn pipeline, classifier, or regressor to Core ML format. Parameters ---------- sk_obj: model | [model] of scikit-learn format. Scikit learn model(s) to convert to a Core ML format. ...
[ "Convert", "scikit", "-", "learn", "pipeline", "classifier", "or", "regressor", "to", "Core", "ML", "format", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_converter.py#L10-L148
[ "def", "convert", "(", "sk_obj", ",", "input_features", "=", "None", ",", "output_feature_names", "=", "None", ")", ":", "# This function is just a thin wrapper around the internal converter so", "# that sklearn isn't actually imported unless this function is called", "from", ".", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ParseMessage
Generate a new Message instance from this Descriptor and a byte string. Args: descriptor: Protobuf Descriptor object byte_str: Serialized protocol buffer byte string Returns: Newly created protobuf Message object.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/reflection.py
def ParseMessage(descriptor, byte_str): """Generate a new Message instance from this Descriptor and a byte string. Args: descriptor: Protobuf Descriptor object byte_str: Serialized protocol buffer byte string Returns: Newly created protobuf Message object. """ result_class = MakeClass(descriptor...
def ParseMessage(descriptor, byte_str): """Generate a new Message instance from this Descriptor and a byte string. Args: descriptor: Protobuf Descriptor object byte_str: Serialized protocol buffer byte string Returns: Newly created protobuf Message object. """ result_class = MakeClass(descriptor...
[ "Generate", "a", "new", "Message", "instance", "from", "this", "Descriptor", "and", "a", "byte", "string", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/reflection.py#L67-L80
[ "def", "ParseMessage", "(", "descriptor", ",", "byte_str", ")", ":", "result_class", "=", "MakeClass", "(", "descriptor", ")", "new_msg", "=", "result_class", "(", ")", "new_msg", ".", "ParseFromString", "(", "byte_str", ")", "return", "new_msg" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
MakeClass
Construct a class object for a protobuf described by descriptor. Composite descriptors are handled by defining the new class as a member of the parent class, recursing as deep as necessary. This is the dynamic equivalent to: class Parent(message.Message): __metaclass__ = GeneratedProtocolMessageType D...
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/reflection.py
def MakeClass(descriptor): """Construct a class object for a protobuf described by descriptor. Composite descriptors are handled by defining the new class as a member of the parent class, recursing as deep as necessary. This is the dynamic equivalent to: class Parent(message.Message): __metaclass__ = Ge...
def MakeClass(descriptor): """Construct a class object for a protobuf described by descriptor. Composite descriptors are handled by defining the new class as a member of the parent class, recursing as deep as necessary. This is the dynamic equivalent to: class Parent(message.Message): __metaclass__ = Ge...
[ "Construct", "a", "class", "object", "for", "a", "protobuf", "described", "by", "descriptor", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/reflection.py#L83-L121
[ "def", "MakeClass", "(", "descriptor", ")", ":", "if", "descriptor", "in", "MESSAGE_CLASS_CACHE", ":", "return", "MESSAGE_CLASS_CACHE", "[", "descriptor", "]", "attributes", "=", "{", "}", "for", "name", ",", "nested_type", "in", "descriptor", ".", "nested_types...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
load_images
Loads images from a directory. JPEG and PNG images are supported. Parameters ---------- url : str The string of the path where all the images are stored. format : {'PNG' | 'JPG' | 'auto'}, optional The format of the images in the directory. The default 'auto' parameter value tr...
src/unity/python/turicreate/toolkits/image_analysis/image_analysis.py
def load_images(url, format='auto', with_path=True, recursive=True, ignore_failure=True, random_order=False): """ Loads images from a directory. JPEG and PNG images are supported. Parameters ---------- url : str The string of the path where all the images are stored. format : {'PNG' | ...
def load_images(url, format='auto', with_path=True, recursive=True, ignore_failure=True, random_order=False): """ Loads images from a directory. JPEG and PNG images are supported. Parameters ---------- url : str The string of the path where all the images are stored. format : {'PNG' | ...
[ "Loads", "images", "from", "a", "directory", ".", "JPEG", "and", "PNG", "images", "are", "supported", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_analysis/image_analysis.py#L12-L60
[ "def", "load_images", "(", "url", ",", "format", "=", "'auto'", ",", "with_path", "=", "True", ",", "recursive", "=", "True", ",", "ignore_failure", "=", "True", ",", "random_order", "=", "False", ")", ":", "from", ".", ".", ".", "import", "extensions", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_decode
Internal helper function for decoding a single Image or an SArray of Images
src/unity/python/turicreate/toolkits/image_analysis/image_analysis.py
def _decode(image_data): """ Internal helper function for decoding a single Image or an SArray of Images """ from ...data_structures.sarray import SArray as _SArray from ... import extensions as _extensions if type(image_data) is _SArray: return _extensions.decode_image_sarray(image_data...
def _decode(image_data): """ Internal helper function for decoding a single Image or an SArray of Images """ from ...data_structures.sarray import SArray as _SArray from ... import extensions as _extensions if type(image_data) is _SArray: return _extensions.decode_image_sarray(image_data...
[ "Internal", "helper", "function", "for", "decoding", "a", "single", "Image", "or", "an", "SArray", "of", "Images" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_analysis/image_analysis.py#L63-L72
[ "def", "_decode", "(", "image_data", ")", ":", "from", ".", ".", ".", "data_structures", ".", "sarray", "import", "SArray", "as", "_SArray", "from", ".", ".", ".", "import", "extensions", "as", "_extensions", "if", "type", "(", "image_data", ")", "is", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
resize
Resizes the image or SArray of Images to a specific width, height, and number of channels. Parameters ---------- image : turicreate.Image | SArray The image or SArray of images to be resized. width : int The width the image is resized to. height : int The height the ima...
src/unity/python/turicreate/toolkits/image_analysis/image_analysis.py
def resize(image, width, height, channels=None, decode=False, resample='nearest'): """ Resizes the image or SArray of Images to a specific width, height, and number of channels. Parameters ---------- image : turicreate.Image | SArray The image or SArray of images to be resiz...
def resize(image, width, height, channels=None, decode=False, resample='nearest'): """ Resizes the image or SArray of Images to a specific width, height, and number of channels. Parameters ---------- image : turicreate.Image | SArray The image or SArray of images to be resiz...
[ "Resizes", "the", "image", "or", "SArray", "of", "Images", "to", "a", "specific", "width", "height", "and", "number", "of", "channels", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_analysis/image_analysis.py#L76-L161
[ "def", "resize", "(", "image", ",", "width", ",", "height", ",", "channels", "=", "None", ",", "decode", "=", "False", ",", "resample", "=", "'nearest'", ")", ":", "if", "height", "<", "0", "or", "width", "<", "0", ":", "raise", "ValueError", "(", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_convert_1bit_array_to_byte_array
Convert bit array to byte array. :param arr: list Bits as a list where each element is an integer of 0 or 1 Returns ------- numpy.array 1D numpy array of type uint8
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
def _convert_1bit_array_to_byte_array(arr): """ Convert bit array to byte array. :param arr: list Bits as a list where each element is an integer of 0 or 1 Returns ------- numpy.array 1D numpy array of type uint8 """ # Padding if necessary while len(arr) < 8 or len(...
def _convert_1bit_array_to_byte_array(arr): """ Convert bit array to byte array. :param arr: list Bits as a list where each element is an integer of 0 or 1 Returns ------- numpy.array 1D numpy array of type uint8 """ # Padding if necessary while len(arr) < 8 or len(...
[ "Convert", "bit", "array", "to", "byte", "array", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L34-L65
[ "def", "_convert_1bit_array_to_byte_array", "(", "arr", ")", ":", "# Padding if necessary", "while", "len", "(", "arr", ")", "<", "8", "or", "len", "(", "arr", ")", "%", "8", ":", "arr", ".", "append", "(", "0", ")", "arr", "=", "_np", ".", "array", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_decompose_bytes_to_bit_arr
Unpack bytes to bits :param arr: list Byte Stream, as a list of uint8 values Returns ------- bit_arr: list Decomposed bit stream as a list of 0/1s of length (len(arr) * 8)
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
def _decompose_bytes_to_bit_arr(arr): """ Unpack bytes to bits :param arr: list Byte Stream, as a list of uint8 values Returns ------- bit_arr: list Decomposed bit stream as a list of 0/1s of length (len(arr) * 8) """ bit_arr = [] for idx in range(len(arr)): ...
def _decompose_bytes_to_bit_arr(arr): """ Unpack bytes to bits :param arr: list Byte Stream, as a list of uint8 values Returns ------- bit_arr: list Decomposed bit stream as a list of 0/1s of length (len(arr) * 8) """ bit_arr = [] for idx in range(len(arr)): ...
[ "Unpack", "bytes", "to", "bits" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L77-L93
[ "def", "_decompose_bytes_to_bit_arr", "(", "arr", ")", ":", "bit_arr", "=", "[", "]", "for", "idx", "in", "range", "(", "len", "(", "arr", ")", ")", ":", "for", "i", "in", "reversed", "(", "range", "(", "8", ")", ")", ":", "bit_arr", ".", "append",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_get_linear_lookup_table_and_weight
Generate a linear lookup table. :param nbits: int Number of bits to represent a quantized weight value :param wp: numpy.array Weight blob to be quantized Returns ------- lookup_table: numpy.array Lookup table of shape (2^nbits, ) qw: numpy.array Decomposed bit ...
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
def _get_linear_lookup_table_and_weight(nbits, wp): """ Generate a linear lookup table. :param nbits: int Number of bits to represent a quantized weight value :param wp: numpy.array Weight blob to be quantized Returns ------- lookup_table: numpy.array Lookup table ...
def _get_linear_lookup_table_and_weight(nbits, wp): """ Generate a linear lookup table. :param nbits: int Number of bits to represent a quantized weight value :param wp: numpy.array Weight blob to be quantized Returns ------- lookup_table: numpy.array Lookup table ...
[ "Generate", "a", "linear", "lookup", "table", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L96-L117
[ "def", "_get_linear_lookup_table_and_weight", "(", "nbits", ",", "wp", ")", ":", "w", "=", "wp", ".", "reshape", "(", "1", ",", "-", "1", ")", "qw", ",", "scales", ",", "biases", "=", "_quantize_channelwise_linear", "(", "w", ",", "nbits", ",", "axis", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_get_kmeans_lookup_table_and_weight
Generate K-Means lookup table given a weight parameter field :param nbits: Number of bits for quantization :param w: Weight as numpy array Returns ------- lut: numpy.array Lookup table, numpy array of shape (1 << nbits, ); wq: numpy.array Quantized weight of ty...
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
def _get_kmeans_lookup_table_and_weight(nbits, w, init='k-means++', tol=1e-2, n_init=1, rand_seed=0): """ Generate K-Means lookup table given a weight parameter field :param nbits: Number of bits for quantization :param w: Weight as numpy array Returns ------- lut: numpy.a...
def _get_kmeans_lookup_table_and_weight(nbits, w, init='k-means++', tol=1e-2, n_init=1, rand_seed=0): """ Generate K-Means lookup table given a weight parameter field :param nbits: Number of bits for quantization :param w: Weight as numpy array Returns ------- lut: numpy.a...
[ "Generate", "K", "-", "Means", "lookup", "table", "given", "a", "weight", "parameter", "field" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L120-L149
[ "def", "_get_kmeans_lookup_table_and_weight", "(", "nbits", ",", "w", ",", "init", "=", "'k-means++'", ",", "tol", "=", "1e-2", ",", "n_init", "=", "1", ",", "rand_seed", "=", "0", ")", ":", "if", "_HAS_SKLEARN", ":", "from", "sklearn", ".", "cluster", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_quantize_channelwise_linear
Linearly quantize weight blob. :param weight: numpy.array Weight to be quantized. :param nbits: int Number of bits per weight element :param axis: int Axis of the weight blob to compute channel-wise quantization, can be 0 or 1 Returns ------- quantized_weight: numpy.a...
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
def _quantize_channelwise_linear(weight, nbits, axis=0): """ Linearly quantize weight blob. :param weight: numpy.array Weight to be quantized. :param nbits: int Number of bits per weight element :param axis: int Axis of the weight blob to compute channel-wise quantization,...
def _quantize_channelwise_linear(weight, nbits, axis=0): """ Linearly quantize weight blob. :param weight: numpy.array Weight to be quantized. :param nbits: int Number of bits per weight element :param axis: int Axis of the weight blob to compute channel-wise quantization,...
[ "Linearly", "quantize", "weight", "blob", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L151-L212
[ "def", "_quantize_channelwise_linear", "(", "weight", ",", "nbits", ",", "axis", "=", "0", ")", ":", "if", "len", "(", "weight", ".", "shape", ")", "==", "1", ":", "# vector situation, treat as 1 channel", "weight", "=", "weight", ".", "reshape", "(", "(", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_quantize_wp
Quantize the weight blob :param wp: numpy.array Weight parameters :param nbits: int Number of bits :param qm: Quantization mode :param lut_function: (``callable function``) Python callable representing a look-up table Returns ------- scale: numpy.array ...
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
def _quantize_wp(wp, nbits, qm, axis=0, **kwargs): """ Quantize the weight blob :param wp: numpy.array Weight parameters :param nbits: int Number of bits :param qm: Quantization mode :param lut_function: (``callable function``) Python callable representing a look...
def _quantize_wp(wp, nbits, qm, axis=0, **kwargs): """ Quantize the weight blob :param wp: numpy.array Weight parameters :param nbits: int Number of bits :param qm: Quantization mode :param lut_function: (``callable function``) Python callable representing a look...
[ "Quantize", "the", "weight", "blob" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L215-L266
[ "def", "_quantize_wp", "(", "wp", ",", "nbits", ",", "qm", ",", "axis", "=", "0", ",", "*", "*", "kwargs", ")", ":", "scale", "=", "bias", "=", "lut", "=", "None", "# Linear Quantization", "if", "qm", "==", "_QUANTIZATION_MODE_LINEAR_QUANTIZATION", ":", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_quantize_wp_field
Quantize WeightParam field in Neural Network Protobuf :param wp: MLModel.NeuralNetwork.WeightParam WeightParam field :param nbits: int Number of bits to be quantized :param qm: str Quantization mode :param shape: tuple Tensor shape held by wp :param axis: int ...
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
def _quantize_wp_field(wp, nbits, qm, shape, axis=0, **kwargs): """ Quantize WeightParam field in Neural Network Protobuf :param wp: MLModel.NeuralNetwork.WeightParam WeightParam field :param nbits: int Number of bits to be quantized :param qm: str Quantization mode :pa...
def _quantize_wp_field(wp, nbits, qm, shape, axis=0, **kwargs): """ Quantize WeightParam field in Neural Network Protobuf :param wp: MLModel.NeuralNetwork.WeightParam WeightParam field :param nbits: int Number of bits to be quantized :param qm: str Quantization mode :pa...
[ "Quantize", "WeightParam", "field", "in", "Neural", "Network", "Protobuf" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L269-L336
[ "def", "_quantize_wp_field", "(", "wp", ",", "nbits", ",", "qm", ",", "shape", ",", "axis", "=", "0", ",", "*", "*", "kwargs", ")", ":", "# De-quantization", "if", "qm", "==", "_QUANTIZATION_MODE_DEQUANTIZE", ":", "return", "_dequantize_wp", "(", "wp", ","...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
compare_models
Utility function to compare the performance of a full precision vs quantized model :param full_precision_model: MLModel The full precision model with float32 weights :param quantized_model: MLModel Quantized version of the model with quantized weights :param sample_data: str | [dict] ...
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
def compare_models(full_precision_model, quantized_model, sample_data): """ Utility function to compare the performance of a full precision vs quantized model :param full_precision_model: MLModel The full precision model with float32 weights :param quantized_model...
def compare_models(full_precision_model, quantized_model, sample_data): """ Utility function to compare the performance of a full precision vs quantized model :param full_precision_model: MLModel The full precision model with float32 weights :param quantized_model...
[ "Utility", "function", "to", "compare", "the", "performance", "of", "a", "full", "precision", "vs", "quantized", "model" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L829-L874
[ "def", "compare_models", "(", "full_precision_model", ",", "quantized_model", ",", "sample_data", ")", ":", "emessage", "=", "(", "\"\"\"\n Invalid sample data provided. Only a list of dictionaries\n containing sample data or path to a folder containing images is\n supported\"\"\"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
quantize_weights
Utility function to convert a full precision (float) MLModel to a nbit quantized MLModel (float16). :param full_precision_model: MLModel Model which will be converted to half precision. Currently conversion for only neural network models is supported. If a pipeline model is passed in th...
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
def quantize_weights(full_precision_model, nbits, quantization_mode="linear", sample_data=None, **kwargs): """ Utility function to convert a full precision (float) MLModel to a nbit quantized MLModel (float16). :param f...
def quantize_weights(full_precision_model, nbits, quantization_mode="linear", sample_data=None, **kwargs): """ Utility function to convert a full precision (float) MLModel to a nbit quantized MLModel (float16). :param f...
[ "Utility", "function", "to", "convert", "a", "full", "precision", "(", "float", ")", "MLModel", "to", "a", "nbit", "quantized", "MLModel", "(", "float16", ")", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L877-L977
[ "def", "quantize_weights", "(", "full_precision_model", ",", "nbits", ",", "quantization_mode", "=", "\"linear\"", ",", "sample_data", "=", "None", ",", "*", "*", "kwargs", ")", ":", "qmode_mapping", "=", "{", "\"linear\"", ":", "_QUANTIZATION_MODE_LINEAR_QUANTIZATI...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create
Create a recommender that uses item-item similarities based on users in common. Parameters ---------- observation_data : SFrame The dataset to use for training the model. It must contain a column of user ids and a column of item ids. Each row represents an observed interaction b...
src/unity/python/turicreate/toolkits/recommender/item_similarity_recommender.py
def create(observation_data, user_id='user_id', item_id='item_id', target=None, user_data=None, item_data=None, nearest_items=None, similarity_type='jaccard', threshold=0.001, only_top_k=64, verbose=True, target_memory_usage = 8*102...
def create(observation_data, user_id='user_id', item_id='item_id', target=None, user_data=None, item_data=None, nearest_items=None, similarity_type='jaccard', threshold=0.001, only_top_k=64, verbose=True, target_memory_usage = 8*102...
[ "Create", "a", "recommender", "that", "uses", "item", "-", "item", "similarities", "based", "on", "users", "in", "common", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/item_similarity_recommender.py#L17-L259
[ "def", "create", "(", "observation_data", ",", "user_id", "=", "'user_id'", ",", "item_id", "=", "'item_id'", ",", "target", "=", "None", ",", "user_data", "=", "None", ",", "item_data", "=", "None", ",", "nearest_items", "=", "None", ",", "similarity_type",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_get_elementwise_name_from_keras_layer
Get the keras layer name from the activation name.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
def _get_elementwise_name_from_keras_layer(keras_layer): """ Get the keras layer name from the activation name. """ if isinstance(keras_layer, _keras.layers.Add): return 'ADD' elif isinstance(keras_layer, _keras.layers.Multiply): return 'MULTIPLY' elif isinstance(keras_layer, _ke...
def _get_elementwise_name_from_keras_layer(keras_layer): """ Get the keras layer name from the activation name. """ if isinstance(keras_layer, _keras.layers.Add): return 'ADD' elif isinstance(keras_layer, _keras.layers.Multiply): return 'MULTIPLY' elif isinstance(keras_layer, _ke...
[ "Get", "the", "keras", "layer", "name", "from", "the", "activation", "name", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L76-L117
[ "def", "_get_elementwise_name_from_keras_layer", "(", "keras_layer", ")", ":", "if", "isinstance", "(", "keras_layer", ",", "_keras", ".", "layers", ".", "Add", ")", ":", "return", "'ADD'", "elif", "isinstance", "(", "keras_layer", ",", "_keras", ".", "layers", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_dense
Convert a dense layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
def convert_dense(builder, layer, input_names, output_names, keras_layer): """ Convert a dense layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input and o...
def convert_dense(builder, layer, input_names, output_names, keras_layer): """ Convert a dense layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input and o...
[ "Convert", "a", "dense", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L137-L165
[ "def", "convert_dense", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", "0", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_embedding
Convert a dense layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
def convert_embedding(builder, layer, input_names, output_names, keras_layer): """Convert a dense layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input and ou...
def convert_embedding(builder, layer, input_names, output_names, keras_layer): """Convert a dense layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input and ou...
[ "Convert", "a", "dense", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L167-L192
[ "def", "convert_embedding", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_activation
Convert an activation layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
def convert_activation(builder, layer, input_names, output_names, keras_layer): """ Convert an activation layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get ...
def convert_activation(builder, layer, input_names, output_names, keras_layer): """ Convert an activation layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get ...
[ "Convert", "an", "activation", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L194-L267
[ "def", "convert_activation", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_advanced_relu
Convert an ReLU layer with maximum value from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
def convert_advanced_relu(builder, layer, input_names, output_names, keras_layer): """ Convert an ReLU layer with maximum value from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. ...
def convert_advanced_relu(builder, layer, input_names, output_names, keras_layer): """ Convert an ReLU layer with maximum value from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. ...
[ "Convert", "an", "ReLU", "layer", "with", "maximum", "value", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L269-L302
[ "def", "convert_advanced_relu", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_convolution
Convert convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
def convert_convolution(builder, layer, input_names, output_names, keras_layer): """ Convert convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ _check...
def convert_convolution(builder, layer, input_names, output_names, keras_layer): """ Convert convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ _check...
[ "Convert", "convolution", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L304-L383
[ "def", "convert_convolution", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "_check_data_format", "(", "keras_layer", ")", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_convolution1d
Convert convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
def convert_convolution1d(builder, layer, input_names, output_names, keras_layer): """ Convert convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get...
def convert_convolution1d(builder, layer, input_names, output_names, keras_layer): """ Convert convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get...
[ "Convert", "convolution", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L386-L449
[ "def", "convert_convolution1d", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_separable_convolution
Convert separable convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
def convert_separable_convolution(builder, layer, input_names, output_names, keras_layer): """ Convert separable convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object....
def convert_separable_convolution(builder, layer, input_names, output_names, keras_layer): """ Convert separable convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object....
[ "Convert", "separable", "convolution", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L451-L529
[ "def", "convert_separable_convolution", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "_check_data_format", "(", "keras_layer", ")", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "inp...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_batchnorm
Convert a Batch Normalization layer. Parameters keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
def convert_batchnorm(builder, layer, input_names, output_names, keras_layer): """ Convert a Batch Normalization layer. Parameters keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input and output names i...
def convert_batchnorm(builder, layer, input_names, output_names, keras_layer): """ Convert a Batch Normalization layer. Parameters keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input and output names i...
[ "Convert", "a", "Batch", "Normalization", "layer", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L531-L581
[ "def", "convert_batchnorm", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_flatten
Convert a flatten layer from keras to coreml. ---------- Parameters keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
def convert_flatten(builder, layer, input_names, output_names, keras_layer): """ Convert a flatten layer from keras to coreml. ---------- Parameters keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ input_name, ou...
def convert_flatten(builder, layer, input_names, output_names, keras_layer): """ Convert a flatten layer from keras to coreml. ---------- Parameters keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ input_name, ou...
[ "Convert", "a", "flatten", "layer", "from", "keras", "to", "coreml", ".", "----------", "Parameters", "keras_layer", ":", "layer", "A", "keras", "layer", "object", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L584-L619
[ "def", "convert_flatten", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", "0", "]", ")", "# blob_order ==...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_merge
Convert concat layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
def convert_merge(builder, layer, input_names, output_names, keras_layer): """ Convert concat layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input and ou...
def convert_merge(builder, layer, input_names, output_names, keras_layer): """ Convert concat layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get input and ou...
[ "Convert", "concat", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L621-L638
[ "def", "convert_merge", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "# Get input and output names", "output_name", "=", "output_names", "[", "0", "]", "mode", "=", "_get_elementwise_name_from_keras_layer", "(", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_pooling
Convert pooling layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
def convert_pooling(builder, layer, input_names, output_names, keras_layer): """ Convert pooling layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ _check_data_for...
def convert_pooling(builder, layer, input_names, output_names, keras_layer): """ Convert pooling layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ _check_data_for...
[ "Convert", "pooling", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L640-L729
[ "def", "convert_pooling", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "_check_data_format", "(", "keras_layer", ")", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_padding
Convert padding layer from keras to coreml. Keras only supports zero padding at this time. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
def convert_padding(builder, layer, input_names, output_names, keras_layer): """ Convert padding layer from keras to coreml. Keras only supports zero padding at this time. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural n...
def convert_padding(builder, layer, input_names, output_names, keras_layer): """ Convert padding layer from keras to coreml. Keras only supports zero padding at this time. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural n...
[ "Convert", "padding", "layer", "from", "keras", "to", "coreml", ".", "Keras", "only", "supports", "zero", "padding", "at", "this", "time", ".", "Parameters", "----------", "keras_layer", ":", "layer", "A", "keras", "layer", "object", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L731-L782
[ "def", "convert_padding", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "_check_data_format", "(", "keras_layer", ")", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_cropping
Convert padding layer from keras to coreml. Keras only supports zero padding at this time. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
def convert_cropping(builder, layer, input_names, output_names, keras_layer): """ Convert padding layer from keras to coreml. Keras only supports zero padding at this time. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural ...
def convert_cropping(builder, layer, input_names, output_names, keras_layer): """ Convert padding layer from keras to coreml. Keras only supports zero padding at this time. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural ...
[ "Convert", "padding", "layer", "from", "keras", "to", "coreml", ".", "Keras", "only", "supports", "zero", "padding", "at", "this", "time", ".", "Parameters", "----------", "keras_layer", ":", "layer", "A", "keras", "layer", "object", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L784-L835
[ "def", "convert_cropping", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "_check_data_format", "(", "keras_layer", ")", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_upsample
Convert convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
def convert_upsample(builder, layer, input_names, output_names, keras_layer): """ Convert convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ _check_dat...
def convert_upsample(builder, layer, input_names, output_names, keras_layer): """ Convert convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ _check_dat...
[ "Convert", "convolution", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L837-L880
[ "def", "convert_upsample", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "_check_data_format", "(", "keras_layer", ")", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_permute
Convert a softmax layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
def convert_permute(builder, layer, input_names, output_names, keras_layer): """ Convert a softmax layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ input_name, o...
def convert_permute(builder, layer, input_names, output_names, keras_layer): """ Convert a softmax layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ input_name, o...
[ "Convert", "a", "softmax", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L882-L916
[ "def", "convert_permute", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", "0", "]", ")", "keras_dims", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_simple_rnn
Convert an SimpleRNN layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
def convert_simple_rnn(builder, layer, input_names, output_names, keras_layer): """ Convert an SimpleRNN layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get i...
def convert_simple_rnn(builder, layer, input_names, output_names, keras_layer): """ Convert an SimpleRNN layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ # Get i...
[ "Convert", "an", "SimpleRNN", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L951-L995
[ "def", "convert_simple_rnn", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "# Get input and output names", "hidden_size", "=", "keras_layer", ".", "units", "input_size", "=", "keras_layer", ".", "input_shape", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_lstm
Convert an LSTM layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
def convert_lstm(builder, layer, input_names, output_names, keras_layer): """ Convert an LSTM layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ hidden_size = ker...
def convert_lstm(builder, layer, input_names, output_names, keras_layer): """ Convert an LSTM layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ hidden_size = ker...
[ "Convert", "an", "LSTM", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L997-L1055
[ "def", "convert_lstm", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "hidden_size", "=", "keras_layer", ".", "units", "input_size", "=", "keras_layer", ".", "input_shape", "[", "-", "1", "]", "output_all",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_gru
Convert a GRU layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
def convert_gru(builder, layer, input_names, output_names, keras_layer): """ Convert a GRU layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ hidden_size = keras_...
def convert_gru(builder, layer, input_names, output_names, keras_layer): """ Convert a GRU layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ hidden_size = keras_...
[ "Convert", "a", "GRU", "layer", "from", "keras", "to", "coreml", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L1057-L1112
[ "def", "convert_gru", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "hidden_size", "=", "keras_layer", ".", "units", "input_size", "=", "keras_layer", ".", "input_shape", "[", "-", "1", "]", "output_all", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert_bidirectional
Convert a bidirectional layer from keras to coreml. Currently assumes the units are LSTMs. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
def convert_bidirectional(builder, layer, input_names, output_names, keras_layer): """ Convert a bidirectional layer from keras to coreml. Currently assumes the units are LSTMs. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A n...
def convert_bidirectional(builder, layer, input_names, output_names, keras_layer): """ Convert a bidirectional layer from keras to coreml. Currently assumes the units are LSTMs. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A n...
[ "Convert", "a", "bidirectional", "layer", "from", "keras", "to", "coreml", ".", "Currently", "assumes", "the", "units", "are", "LSTMs", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L1114-L1232
[ "def", "convert_bidirectional", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "input_size", "=", "keras_layer", ".", "input_shape", "[", "-", "1", "]", "lstm_layer", "=", "keras_layer", ".", "forward_layer",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
SimpleInstructions.SLICE_0
obj[:]
src/unity/python/turicreate/meta/decompiler/simple_instructions.py
def SLICE_0(self, instr): 'obj[:]' value = self.ast_stack.pop() kw = dict(lineno=instr.lineno, col_offset=0) slice = _ast.Slice(lower=None, step=None, upper=None, **kw) subscr = _ast.Subscript(value=value, slice=slice, ctx=_ast.Load(), **kw) self.ast_stack.append(subscr...
def SLICE_0(self, instr): 'obj[:]' value = self.ast_stack.pop() kw = dict(lineno=instr.lineno, col_offset=0) slice = _ast.Slice(lower=None, step=None, upper=None, **kw) subscr = _ast.Subscript(value=value, slice=slice, ctx=_ast.Load(), **kw) self.ast_stack.append(subscr...
[ "obj", "[", ":", "]" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/decompiler/simple_instructions.py#L723-L731
[ "def", "SLICE_0", "(", "self", ",", "instr", ")", ":", "value", "=", "self", ".", "ast_stack", ".", "pop", "(", ")", "kw", "=", "dict", "(", "lineno", "=", "instr", ".", "lineno", ",", "col_offset", "=", "0", ")", "slice", "=", "_ast", ".", "Slic...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
SimpleInstructions.STORE_SLICE_1
obj[lower:] = expr
src/unity/python/turicreate/meta/decompiler/simple_instructions.py
def STORE_SLICE_1(self, instr): 'obj[lower:] = expr' lower = self.ast_stack.pop() value = self.ast_stack.pop() expr = self.ast_stack.pop() kw = dict(lineno=instr.lineno, col_offset=0) slice = _ast.Slice(lower=lower, step=None, upper=None, **kw) subscr = _ast.Subs...
def STORE_SLICE_1(self, instr): 'obj[lower:] = expr' lower = self.ast_stack.pop() value = self.ast_stack.pop() expr = self.ast_stack.pop() kw = dict(lineno=instr.lineno, col_offset=0) slice = _ast.Slice(lower=lower, step=None, upper=None, **kw) subscr = _ast.Subs...
[ "obj", "[", "lower", ":", "]", "=", "expr" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/decompiler/simple_instructions.py#L802-L813
[ "def", "STORE_SLICE_1", "(", "self", ",", "instr", ")", ":", "lower", "=", "self", ".", "ast_stack", ".", "pop", "(", ")", "value", "=", "self", ".", "ast_stack", ".", "pop", "(", ")", "expr", "=", "self", ".", "ast_stack", ".", "pop", "(", ")", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
SimpleInstructions.STORE_SLICE_3
obj[lower:upper] = expr
src/unity/python/turicreate/meta/decompiler/simple_instructions.py
def STORE_SLICE_3(self, instr): 'obj[lower:upper] = expr' upper = self.ast_stack.pop() lower = self.ast_stack.pop() value = self.ast_stack.pop() expr = self.ast_stack.pop() kw = dict(lineno=instr.lineno, col_offset=0) slice = _ast.Slice(lower=lower, step...
def STORE_SLICE_3(self, instr): 'obj[lower:upper] = expr' upper = self.ast_stack.pop() lower = self.ast_stack.pop() value = self.ast_stack.pop() expr = self.ast_stack.pop() kw = dict(lineno=instr.lineno, col_offset=0) slice = _ast.Slice(lower=lower, step...
[ "obj", "[", "lower", ":", "upper", "]", "=", "expr" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/decompiler/simple_instructions.py#L829-L849
[ "def", "STORE_SLICE_3", "(", "self", ",", "instr", ")", ":", "upper", "=", "self", ".", "ast_stack", ".", "pop", "(", ")", "lower", "=", "self", ".", "ast_stack", ".", "pop", "(", ")", "value", "=", "self", ".", "ast_stack", ".", "pop", "(", ")", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
SimpleInstructions.DELETE_SLICE_0
obj[:] = expr
src/unity/python/turicreate/meta/decompiler/simple_instructions.py
def DELETE_SLICE_0(self, instr): 'obj[:] = expr' value = self.ast_stack.pop() kw = dict(lineno=instr.lineno, col_offset=0) slice = _ast.Slice(lower=None, step=None, upper=None, **kw) subscr = _ast.Subscript(value=value, slice=slice, ctx=_ast.Del(), **kw) delete = _ast.D...
def DELETE_SLICE_0(self, instr): 'obj[:] = expr' value = self.ast_stack.pop() kw = dict(lineno=instr.lineno, col_offset=0) slice = _ast.Slice(lower=None, step=None, upper=None, **kw) subscr = _ast.Subscript(value=value, slice=slice, ctx=_ast.Del(), **kw) delete = _ast.D...
[ "obj", "[", ":", "]", "=", "expr" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/decompiler/simple_instructions.py#L851-L860
[ "def", "DELETE_SLICE_0", "(", "self", ",", "instr", ")", ":", "value", "=", "self", ".", "ast_stack", ".", "pop", "(", ")", "kw", "=", "dict", "(", "lineno", "=", "instr", ".", "lineno", ",", "col_offset", "=", "0", ")", "slice", "=", "_ast", ".", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create
Create a content-based recommender model in which the similarity between the items recommended is determined by the content of those items rather than learned from user interaction data. The similarity score between two items is calculated by first computing the similarity between the item data for eac...
src/unity/python/turicreate/toolkits/recommender/item_content_recommender.py
def create(item_data, item_id, observation_data = None, user_id = None, target = None, weights = 'auto', similarity_metrics = 'auto', item_data_transform = 'auto', max_item_neighborhood_size = 64, verbose=True): """Create a content-based recommender...
def create(item_data, item_id, observation_data = None, user_id = None, target = None, weights = 'auto', similarity_metrics = 'auto', item_data_transform = 'auto', max_item_neighborhood_size = 64, verbose=True): """Create a content-based recommender...
[ "Create", "a", "content", "-", "based", "recommender", "model", "in", "which", "the", "similarity", "between", "the", "items", "recommended", "is", "determined", "by", "the", "content", "of", "those", "items", "rather", "than", "learned", "from", "user", "inte...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/item_content_recommender.py#L20-L255
[ "def", "create", "(", "item_data", ",", "item_id", ",", "observation_data", "=", "None", ",", "user_id", "=", "None", ",", "target", "=", "None", ",", "weights", "=", "'auto'", ",", "similarity_metrics", "=", "'auto'", ",", "item_data_transform", "=", "'auto...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
lhs
Return a set of symbols in `node` that are assigned. :param node: ast node :returns: set of strings.
src/unity/python/turicreate/meta/asttools/visitors/cond_symbol_visitor.py
def lhs(node): ''' Return a set of symbols in `node` that are assigned. :param node: ast node :returns: set of strings. ''' gen = ConditionalSymbolVisitor() if isinstance(node, (list, tuple)): gen.visit_list(node) else: gen.visit(node) return gen.lhs
def lhs(node): ''' Return a set of symbols in `node` that are assigned. :param node: ast node :returns: set of strings. ''' gen = ConditionalSymbolVisitor() if isinstance(node, (list, tuple)): gen.visit_list(node) else: gen.visit(node) return gen.lhs
[ "Return", "a", "set", "of", "symbols", "in", "node", "that", "are", "assigned", ".", ":", "param", "node", ":", "ast", "node", ":", "returns", ":", "set", "of", "strings", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/asttools/visitors/cond_symbol_visitor.py#L363-L377
[ "def", "lhs", "(", "node", ")", ":", "gen", "=", "ConditionalSymbolVisitor", "(", ")", "if", "isinstance", "(", "node", ",", "(", "list", ",", "tuple", ")", ")", ":", "gen", ".", "visit_list", "(", "node", ")", "else", ":", "gen", ".", "visit", "("...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
conditional_lhs
Group outputs into conditional and stable :param node: ast node :returns: tuple of (conditional, stable)
src/unity/python/turicreate/meta/asttools/visitors/cond_symbol_visitor.py
def conditional_lhs(node): ''' Group outputs into conditional and stable :param node: ast node :returns: tuple of (conditional, stable) ''' gen = ConditionalSymbolVisitor() gen.visit(node) return gen.cond_lhs, gen.stable_lhs
def conditional_lhs(node): ''' Group outputs into conditional and stable :param node: ast node :returns: tuple of (conditional, stable) ''' gen = ConditionalSymbolVisitor() gen.visit(node) return gen.cond_lhs, gen.stable_lhs
[ "Group", "outputs", "into", "conditional", "and", "stable", ":", "param", "node", ":", "ast", "node", ":", "returns", ":", "tuple", "of", "(", "conditional", "stable", ")" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/asttools/visitors/cond_symbol_visitor.py#L395-L406
[ "def", "conditional_lhs", "(", "node", ")", ":", "gen", "=", "ConditionalSymbolVisitor", "(", ")", "gen", ".", "visit", "(", "node", ")", "return", "gen", ".", "cond_lhs", ",", "gen", ".", "stable_lhs" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
conditional_symbols
Group lhs and rhs into conditional, stable and undefined :param node: ast node :returns: tuple of (conditional_lhs, stable_lhs),(conditional_rhs, stable_rhs), undefined
src/unity/python/turicreate/meta/asttools/visitors/cond_symbol_visitor.py
def conditional_symbols(node): ''' Group lhs and rhs into conditional, stable and undefined :param node: ast node :returns: tuple of (conditional_lhs, stable_lhs),(conditional_rhs, stable_rhs), undefined ''' gen = ConditionalSymbolVisitor() gen.visit(node) lhs = gen.cond_lhs,...
def conditional_symbols(node): ''' Group lhs and rhs into conditional, stable and undefined :param node: ast node :returns: tuple of (conditional_lhs, stable_lhs),(conditional_rhs, stable_rhs), undefined ''' gen = ConditionalSymbolVisitor() gen.visit(node) lhs = gen.cond_lhs,...
[ "Group", "lhs", "and", "rhs", "into", "conditional", "stable", "and", "undefined", ":", "param", "node", ":", "ast", "node", ":", "returns", ":", "tuple", "of", "(", "conditional_lhs", "stable_lhs", ")", "(", "conditional_rhs", "stable_rhs", ")", "undefined" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/asttools/visitors/cond_symbol_visitor.py#L409-L423
[ "def", "conditional_symbols", "(", "node", ")", ":", "gen", "=", "ConditionalSymbolVisitor", "(", ")", "gen", ".", "visit", "(", "node", ")", "lhs", "=", "gen", ".", "cond_lhs", ",", "gen", ".", "stable_lhs", "rhs", "=", "gen", ".", "cond_rhs", ",", "g...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_loadlib
Load rabit library.
src/external/xgboost/subtree/rabit/wrapper/rabit.py
def _loadlib(lib='standard'): """Load rabit library.""" global _LIB if _LIB is not None: warnings.warn('rabit.int call was ignored because it has'\ ' already been initialized', level=2) return if lib == 'standard': _LIB = ctypes.cdll.LoadLibrary(WRAPPER_...
def _loadlib(lib='standard'): """Load rabit library.""" global _LIB if _LIB is not None: warnings.warn('rabit.int call was ignored because it has'\ ' already been initialized', level=2) return if lib == 'standard': _LIB = ctypes.cdll.LoadLibrary(WRAPPER_...
[ "Load", "rabit", "library", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/wrapper/rabit.py#L25-L42
[ "def", "_loadlib", "(", "lib", "=", "'standard'", ")", ":", "global", "_LIB", "if", "_LIB", "is", "not", "None", ":", "warnings", ".", "warn", "(", "'rabit.int call was ignored because it has'", "' already been initialized'", ",", "level", "=", "2", ")", "return...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
init
Intialize the rabit module, call this once before using anything. Parameters ---------- args: list of str, optional The list of arguments used to initialized the rabit usually you need to pass in sys.argv. Defaults to sys.argv when it is None. lib: {'standard', 'mock', 'mpi'} ...
src/external/xgboost/subtree/rabit/wrapper/rabit.py
def init(args=None, lib='standard'): """Intialize the rabit module, call this once before using anything. Parameters ---------- args: list of str, optional The list of arguments used to initialized the rabit usually you need to pass in sys.argv. Defaults to sys.argv when it is N...
def init(args=None, lib='standard'): """Intialize the rabit module, call this once before using anything. Parameters ---------- args: list of str, optional The list of arguments used to initialized the rabit usually you need to pass in sys.argv. Defaults to sys.argv when it is N...
[ "Intialize", "the", "rabit", "module", "call", "this", "once", "before", "using", "anything", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/wrapper/rabit.py#L56-L73
[ "def", "init", "(", "args", "=", "None", ",", "lib", "=", "'standard'", ")", ":", "if", "args", "is", "None", ":", "args", "=", "sys", ".", "argv", "_loadlib", "(", "lib", ")", "arr", "=", "(", "ctypes", ".", "c_char_p", "*", "len", "(", "args", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e