repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
_sanitize_value
def _sanitize_value(x): """ Performs cleaning steps on the data so various type comparisons can be performed correctly. """ if isinstance(x, _six.string_types + _six.integer_types + (float,)): return x elif _HAS_SKLEARN and _sp.issparse(x): return x.todense() elif isinstance(...
python
def _sanitize_value(x): """ Performs cleaning steps on the data so various type comparisons can be performed correctly. """ if isinstance(x, _six.string_types + _six.integer_types + (float,)): return x elif _HAS_SKLEARN and _sp.issparse(x): return x.todense() elif isinstance(...
[ "def", "_sanitize_value", "(", "x", ")", ":", "if", "isinstance", "(", "x", ",", "_six", ".", "string_types", "+", "_six", ".", "integer_types", "+", "(", "float", ",", ")", ")", ":", "return", "x", "elif", "_HAS_SKLEARN", "and", "_sp", ".", "issparse"...
Performs cleaning steps on the data so various type comparisons can be performed correctly.
[ "Performs", "cleaning", "steps", "on", "the", "data", "so", "various", "type", "comparisons", "can", "be", "performed", "correctly", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L677-L695
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
_element_equal
def _element_equal(x, y): """ Performs a robust equality test between elements. """ if isinstance(x, _np.ndarray) or isinstance(y, _np.ndarray): try: return (abs(_np.asarray(x) - _np.asarray(y)) < 1e-5).all() except: return False elif isinstance(x, dict): ...
python
def _element_equal(x, y): """ Performs a robust equality test between elements. """ if isinstance(x, _np.ndarray) or isinstance(y, _np.ndarray): try: return (abs(_np.asarray(x) - _np.asarray(y)) < 1e-5).all() except: return False elif isinstance(x, dict): ...
[ "def", "_element_equal", "(", "x", ",", "y", ")", ":", "if", "isinstance", "(", "x", ",", "_np", ".", "ndarray", ")", "or", "isinstance", "(", "y", ",", "_np", ".", "ndarray", ")", ":", "try", ":", "return", "(", "abs", "(", "_np", ".", "asarray"...
Performs a robust equality test between elements.
[ "Performs", "a", "robust", "equality", "test", "between", "elements", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L698-L716
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
evaluate_transformer
def evaluate_transformer(model, input_data, reference_output, verbose=False): """ Evaluate a transformer specification for testing. Parameters ---------- spec: [str | MLModel] File from where to load the Model from (OR) a loaded version of MLModel. inpu...
python
def evaluate_transformer(model, input_data, reference_output, verbose=False): """ Evaluate a transformer specification for testing. Parameters ---------- spec: [str | MLModel] File from where to load the Model from (OR) a loaded version of MLModel. inpu...
[ "def", "evaluate_transformer", "(", "model", ",", "input_data", ",", "reference_output", ",", "verbose", "=", "False", ")", ":", "model", "=", "_get_model", "(", "model", ")", "if", "verbose", ":", "print", "(", "model", ")", "print", "(", "\"\"", ")", "...
Evaluate a transformer specification for testing. Parameters ---------- spec: [str | MLModel] File from where to load the Model from (OR) a loaded version of MLModel. input_data: list[dict] Test data on which to evaluate the models. reference_output: list[dict] Exp...
[ "Evaluate", "a", "transformer", "specification", "for", "testing", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L719-L786
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
_get_input_names
def _get_input_names(spec): """ Returns a list of the names of the inputs to this model. :param spec: The model protobuf specification :return: [str] A list of input feature names """ retval = [feature.name for feature in spec.description.input] return retval
python
def _get_input_names(spec): """ Returns a list of the names of the inputs to this model. :param spec: The model protobuf specification :return: [str] A list of input feature names """ retval = [feature.name for feature in spec.description.input] return retval
[ "def", "_get_input_names", "(", "spec", ")", ":", "retval", "=", "[", "feature", ".", "name", "for", "feature", "in", "spec", ".", "description", ".", "input", "]", "return", "retval" ]
Returns a list of the names of the inputs to this model. :param spec: The model protobuf specification :return: [str] A list of input feature names
[ "Returns", "a", "list", "of", "the", "names", "of", "the", "inputs", "to", "this", "model", ".", ":", "param", "spec", ":", "The", "model", "protobuf", "specification", ":", "return", ":", "[", "str", "]", "A", "list", "of", "input", "feature", "names"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L912-L919
train
apple/turicreate
src/unity/python/turicreate/toolkits/graph_analytics/degree_counting.py
create
def create(graph, verbose=True): """ Compute the in degree, out degree and total degree of each vertex. Parameters ---------- graph : SGraph The graph on which to compute degree counts. verbose : bool, optional If True, print progress updates. Returns ------- out :...
python
def create(graph, verbose=True): """ Compute the in degree, out degree and total degree of each vertex. Parameters ---------- graph : SGraph The graph on which to compute degree counts. verbose : bool, optional If True, print progress updates. Returns ------- out :...
[ "def", "create", "(", "graph", ",", "verbose", "=", "True", ")", ":", "from", "turicreate", ".", "_cython", ".", "cy_server", "import", "QuietProgress", "if", "not", "isinstance", "(", "graph", ",", "_SGraph", ")", ":", "raise", "TypeError", "(", "'\"graph...
Compute the in degree, out degree and total degree of each vertex. Parameters ---------- graph : SGraph The graph on which to compute degree counts. verbose : bool, optional If True, print progress updates. Returns ------- out : DegreeCountingModel Examples ------...
[ "Compute", "the", "in", "degree", "out", "degree", "and", "total", "degree", "of", "each", "vertex", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/graph_analytics/degree_counting.py#L57-L119
train
apple/turicreate
deps/src/boost_1_68_0/tools/litre/cplusplus.py
Example.replace_emphasis
def replace_emphasis(self, s, index = 0): """replace the index'th emphasized text with s""" e = self.emphasized[index] self.body[e[0]:e[1]] = [s] del self.emphasized[index]
python
def replace_emphasis(self, s, index = 0): """replace the index'th emphasized text with s""" e = self.emphasized[index] self.body[e[0]:e[1]] = [s] del self.emphasized[index]
[ "def", "replace_emphasis", "(", "self", ",", "s", ",", "index", "=", "0", ")", ":", "e", "=", "self", ".", "emphasized", "[", "index", "]", "self", ".", "body", "[", "e", "[", "0", "]", ":", "e", "[", "1", "]", "]", "=", "[", "s", "]", "del...
replace the index'th emphasized text with s
[ "replace", "the", "index", "th", "emphasized", "text", "with", "s" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/litre/cplusplus.py#L90-L94
train
apple/turicreate
deps/src/boost_1_68_0/tools/litre/cplusplus.py
CPlusPlusTranslator._execute
def _execute(self, code): """Override of litre._execute; sets up variable context before evaluating code """ self.globals['example'] = self.example eval(code, self.globals)
python
def _execute(self, code): """Override of litre._execute; sets up variable context before evaluating code """ self.globals['example'] = self.example eval(code, self.globals)
[ "def", "_execute", "(", "self", ",", "code", ")", ":", "self", ".", "globals", "[", "'example'", "]", "=", "self", ".", "example", "eval", "(", "code", ",", "self", ".", "globals", ")" ]
Override of litre._execute; sets up variable context before evaluating code
[ "Override", "of", "litre", ".", "_execute", ";", "sets", "up", "variable", "context", "before", "evaluating", "code" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/litre/cplusplus.py#L320-L325
train
apple/turicreate
deps/src/boost_1_68_0/tools/litre/cplusplus.py
CPlusPlusTranslator.compile
def compile( self , howmany = 1 , pop = -1 , expect_error = False , extension = '.o' , options = ['-c'] , built_handler = lambda built_file: None , source_file = None , source_suffix = '.cpp' # C-style comments by default; handles C++ a...
python
def compile( self , howmany = 1 , pop = -1 , expect_error = False , extension = '.o' , options = ['-c'] , built_handler = lambda built_file: None , source_file = None , source_suffix = '.cpp' # C-style comments by default; handles C++ a...
[ "def", "compile", "(", "self", ",", "howmany", "=", "1", ",", "pop", "=", "-", "1", ",", "expect_error", "=", "False", ",", "extension", "=", "'.o'", ",", "options", "=", "[", "'-c'", "]", ",", "built_handler", "=", "lambda", "built_file", ":", "None...
Compile examples on the stack, whose topmost item is the last example seen but not yet handled so far. :howmany: How many of the topmost examples on the stack to compile. You can pass a number, or 'all' to indicate that all examples should be compiled. :pop: How many of t...
[ "Compile", "examples", "on", "the", "stack", "whose", "topmost", "item", "is", "the", "last", "example", "seen", "but", "not", "yet", "handled", "so", "far", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/litre/cplusplus.py#L357-L490
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.load
def load (self, jamfile_location): """Loads jamfile at the given location. After loading, project global file and jamfile needed by the loaded one will be loaded recursively. If the jamfile at that location is loaded already, does nothing. Returns the project module for the Jamfile.""" ...
python
def load (self, jamfile_location): """Loads jamfile at the given location. After loading, project global file and jamfile needed by the loaded one will be loaded recursively. If the jamfile at that location is loaded already, does nothing. Returns the project module for the Jamfile.""" ...
[ "def", "load", "(", "self", ",", "jamfile_location", ")", ":", "assert", "isinstance", "(", "jamfile_location", ",", "basestring", ")", "absolute", "=", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", ",", "jamfile_location", ")", "ab...
Loads jamfile at the given location. After loading, project global file and jamfile needed by the loaded one will be loaded recursively. If the jamfile at that location is loaded already, does nothing. Returns the project module for the Jamfile.
[ "Loads", "jamfile", "at", "the", "given", "location", ".", "After", "loading", "project", "global", "file", "and", "jamfile", "needed", "by", "the", "loaded", "one", "will", "be", "loaded", "recursively", ".", "If", "the", "jamfile", "at", "that", "location"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L132-L164
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.load_parent
def load_parent(self, location): """Loads parent of Jamfile at 'location'. Issues an error if nothing is found.""" assert isinstance(location, basestring) found = b2.util.path.glob_in_parents( location, self.JAMROOT + self.JAMFILE) if not found: print "er...
python
def load_parent(self, location): """Loads parent of Jamfile at 'location'. Issues an error if nothing is found.""" assert isinstance(location, basestring) found = b2.util.path.glob_in_parents( location, self.JAMROOT + self.JAMFILE) if not found: print "er...
[ "def", "load_parent", "(", "self", ",", "location", ")", ":", "assert", "isinstance", "(", "location", ",", "basestring", ")", "found", "=", "b2", ".", "util", ".", "path", ".", "glob_in_parents", "(", "location", ",", "self", ".", "JAMROOT", "+", "self"...
Loads parent of Jamfile at 'location'. Issues an error if nothing is found.
[ "Loads", "parent", "of", "Jamfile", "at", "location", ".", "Issues", "an", "error", "if", "nothing", "is", "found", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L178-L190
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.find
def find(self, name, current_location): """Given 'name' which can be project-id or plain directory name, return project module corresponding to that id or directory. Returns nothing of project is not found.""" assert isinstance(name, basestring) assert isinstance(current_location...
python
def find(self, name, current_location): """Given 'name' which can be project-id or plain directory name, return project module corresponding to that id or directory. Returns nothing of project is not found.""" assert isinstance(name, basestring) assert isinstance(current_location...
[ "def", "find", "(", "self", ",", "name", ",", "current_location", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "assert", "isinstance", "(", "current_location", ",", "basestring", ")", "project_module", "=", "None", "# Try interpreting n...
Given 'name' which can be project-id or plain directory name, return project module corresponding to that id or directory. Returns nothing of project is not found.
[ "Given", "name", "which", "can", "be", "project", "-", "id", "or", "plain", "directory", "name", "return", "project", "module", "corresponding", "to", "that", "id", "or", "directory", ".", "Returns", "nothing", "of", "project", "is", "not", "found", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L192-L219
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.module_name
def module_name(self, jamfile_location): """Returns the name of module corresponding to 'jamfile-location'. If no module corresponds to location yet, associates default module name with that location.""" assert isinstance(jamfile_location, basestring) module = self.location2modul...
python
def module_name(self, jamfile_location): """Returns the name of module corresponding to 'jamfile-location'. If no module corresponds to location yet, associates default module name with that location.""" assert isinstance(jamfile_location, basestring) module = self.location2modul...
[ "def", "module_name", "(", "self", ",", "jamfile_location", ")", ":", "assert", "isinstance", "(", "jamfile_location", ",", "basestring", ")", "module", "=", "self", ".", "location2module", ".", "get", "(", "jamfile_location", ")", "if", "not", "module", ":", ...
Returns the name of module corresponding to 'jamfile-location'. If no module corresponds to location yet, associates default module name with that location.
[ "Returns", "the", "name", "of", "module", "corresponding", "to", "jamfile", "-", "location", ".", "If", "no", "module", "corresponds", "to", "location", "yet", "associates", "default", "module", "name", "with", "that", "location", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L221-L235
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.find_jamfile
def find_jamfile (self, dir, parent_root=0, no_errors=0): """Find the Jamfile at the given location. This returns the exact names of all the Jamfiles in the given directory. The optional parent-root argument causes this to search not the given directory but the ones above it up to the di...
python
def find_jamfile (self, dir, parent_root=0, no_errors=0): """Find the Jamfile at the given location. This returns the exact names of all the Jamfiles in the given directory. The optional parent-root argument causes this to search not the given directory but the ones above it up to the di...
[ "def", "find_jamfile", "(", "self", ",", "dir", ",", "parent_root", "=", "0", ",", "no_errors", "=", "0", ")", ":", "assert", "isinstance", "(", "dir", ",", "basestring", ")", "assert", "isinstance", "(", "parent_root", ",", "(", "int", ",", "bool", ")...
Find the Jamfile at the given location. This returns the exact names of all the Jamfiles in the given directory. The optional parent-root argument causes this to search not the given directory but the ones above it up to the directory given in it.
[ "Find", "the", "Jamfile", "at", "the", "given", "location", ".", "This", "returns", "the", "exact", "names", "of", "all", "the", "Jamfiles", "in", "the", "given", "directory", ".", "The", "optional", "parent", "-", "root", "argument", "causes", "this", "to...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L237-L289
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.load_jamfile
def load_jamfile(self, dir, jamfile_module): """Load a Jamfile at the given directory. Returns nothing. Will attempt to load the file as indicated by the JAMFILE patterns. Effect of calling this rule twice with the same 'dir' is underfined.""" assert isinstance(dir, basestring) a...
python
def load_jamfile(self, dir, jamfile_module): """Load a Jamfile at the given directory. Returns nothing. Will attempt to load the file as indicated by the JAMFILE patterns. Effect of calling this rule twice with the same 'dir' is underfined.""" assert isinstance(dir, basestring) a...
[ "def", "load_jamfile", "(", "self", ",", "dir", ",", "jamfile_module", ")", ":", "assert", "isinstance", "(", "dir", ",", "basestring", ")", "assert", "isinstance", "(", "jamfile_module", ",", "basestring", ")", "# See if the Jamfile is where it should be.", "is_jam...
Load a Jamfile at the given directory. Returns nothing. Will attempt to load the file as indicated by the JAMFILE patterns. Effect of calling this rule twice with the same 'dir' is underfined.
[ "Load", "a", "Jamfile", "at", "the", "given", "directory", ".", "Returns", "nothing", ".", "Will", "attempt", "to", "load", "the", "file", "as", "indicated", "by", "the", "JAMFILE", "patterns", ".", "Effect", "of", "calling", "this", "rule", "twice", "with...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L291-L370
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.load_standalone
def load_standalone(self, jamfile_module, file): """Loads 'file' as standalone project that has no location associated with it. This is mostly useful for user-config.jam, which should be able to define targets, but although it has some location in filesystem, we do not want any build to...
python
def load_standalone(self, jamfile_module, file): """Loads 'file' as standalone project that has no location associated with it. This is mostly useful for user-config.jam, which should be able to define targets, but although it has some location in filesystem, we do not want any build to...
[ "def", "load_standalone", "(", "self", ",", "jamfile_module", ",", "file", ")", ":", "assert", "isinstance", "(", "jamfile_module", ",", "basestring", ")", "assert", "isinstance", "(", "file", ",", "basestring", ")", "self", ".", "used_projects", "[", "jamfile...
Loads 'file' as standalone project that has no location associated with it. This is mostly useful for user-config.jam, which should be able to define targets, but although it has some location in filesystem, we do not want any build to happen in user's HOME, for example. The ca...
[ "Loads", "file", "as", "standalone", "project", "that", "has", "no", "location", "associated", "with", "it", ".", "This", "is", "mostly", "useful", "for", "user", "-", "config", ".", "jam", "which", "should", "be", "able", "to", "define", "targets", "but",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L387-L402
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.initialize
def initialize(self, module_name, location=None, basename=None, standalone_path=''): """Initialize the module for a project. module-name is the name of the project module. location is the location (directory) of the project to initialize. If not specified, standalone project wi...
python
def initialize(self, module_name, location=None, basename=None, standalone_path=''): """Initialize the module for a project. module-name is the name of the project module. location is the location (directory) of the project to initialize. If not specified, standalone project wi...
[ "def", "initialize", "(", "self", ",", "module_name", ",", "location", "=", "None", ",", "basename", "=", "None", ",", "standalone_path", "=", "''", ")", ":", "assert", "isinstance", "(", "module_name", ",", "basestring", ")", "assert", "isinstance", "(", ...
Initialize the module for a project. module-name is the name of the project module. location is the location (directory) of the project to initialize. If not specified, standalone project will be initialized standalone_path is the path to the source-location. ...
[ "Initialize", "the", "module", "for", "a", "project", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L412-L509
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.inherit_attributes
def inherit_attributes(self, project_module, parent_module): """Make 'project-module' inherit attributes of project root and parent module.""" assert isinstance(project_module, basestring) assert isinstance(parent_module, basestring) attributes = self.module2attributes[project_m...
python
def inherit_attributes(self, project_module, parent_module): """Make 'project-module' inherit attributes of project root and parent module.""" assert isinstance(project_module, basestring) assert isinstance(parent_module, basestring) attributes = self.module2attributes[project_m...
[ "def", "inherit_attributes", "(", "self", ",", "project_module", ",", "parent_module", ")", ":", "assert", "isinstance", "(", "project_module", ",", "basestring", ")", "assert", "isinstance", "(", "parent_module", ",", "basestring", ")", "attributes", "=", "self",...
Make 'project-module' inherit attributes of project root and parent module.
[ "Make", "project", "-", "module", "inherit", "attributes", "of", "project", "root", "and", "parent", "module", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L511-L549
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.register_id
def register_id(self, id, module): """Associate the given id with the given project module.""" assert isinstance(id, basestring) assert isinstance(module, basestring) self.id2module[id] = module
python
def register_id(self, id, module): """Associate the given id with the given project module.""" assert isinstance(id, basestring) assert isinstance(module, basestring) self.id2module[id] = module
[ "def", "register_id", "(", "self", ",", "id", ",", "module", ")", ":", "assert", "isinstance", "(", "id", ",", "basestring", ")", "assert", "isinstance", "(", "module", ",", "basestring", ")", "self", ".", "id2module", "[", "id", "]", "=", "module" ]
Associate the given id with the given project module.
[ "Associate", "the", "given", "id", "with", "the", "given", "project", "module", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L551-L555
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.push_current
def push_current(self, project): """Temporary changes the current project to 'project'. Should be followed by 'pop-current'.""" if __debug__: from .targets import ProjectTarget assert isinstance(project, ProjectTarget) self.saved_current_project.append(self.curren...
python
def push_current(self, project): """Temporary changes the current project to 'project'. Should be followed by 'pop-current'.""" if __debug__: from .targets import ProjectTarget assert isinstance(project, ProjectTarget) self.saved_current_project.append(self.curren...
[ "def", "push_current", "(", "self", ",", "project", ")", ":", "if", "__debug__", ":", "from", ".", "targets", "import", "ProjectTarget", "assert", "isinstance", "(", "project", ",", "ProjectTarget", ")", "self", ".", "saved_current_project", ".", "append", "("...
Temporary changes the current project to 'project'. Should be followed by 'pop-current'.
[ "Temporary", "changes", "the", "current", "project", "to", "project", ".", "Should", "be", "followed", "by", "pop", "-", "current", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L572-L579
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.attribute
def attribute(self, project, attribute): """Returns the value of the specified attribute in the specified jamfile module.""" assert isinstance(project, basestring) assert isinstance(attribute, basestring) try: return self.module2attributes[project].get(attribute) ...
python
def attribute(self, project, attribute): """Returns the value of the specified attribute in the specified jamfile module.""" assert isinstance(project, basestring) assert isinstance(attribute, basestring) try: return self.module2attributes[project].get(attribute) ...
[ "def", "attribute", "(", "self", ",", "project", ",", "attribute", ")", ":", "assert", "isinstance", "(", "project", ",", "basestring", ")", "assert", "isinstance", "(", "attribute", ",", "basestring", ")", "try", ":", "return", "self", ".", "module2attribut...
Returns the value of the specified attribute in the specified jamfile module.
[ "Returns", "the", "value", "of", "the", "specified", "attribute", "in", "the", "specified", "jamfile", "module", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L593-L601
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.attributeDefault
def attributeDefault(self, project, attribute, default): """Returns the value of the specified attribute in the specified jamfile module.""" assert isinstance(project, basestring) assert isinstance(attribute, basestring) assert isinstance(default, basestring) or default is None ...
python
def attributeDefault(self, project, attribute, default): """Returns the value of the specified attribute in the specified jamfile module.""" assert isinstance(project, basestring) assert isinstance(attribute, basestring) assert isinstance(default, basestring) or default is None ...
[ "def", "attributeDefault", "(", "self", ",", "project", ",", "attribute", ",", "default", ")", ":", "assert", "isinstance", "(", "project", ",", "basestring", ")", "assert", "isinstance", "(", "attribute", ",", "basestring", ")", "assert", "isinstance", "(", ...
Returns the value of the specified attribute in the specified jamfile module.
[ "Returns", "the", "value", "of", "the", "specified", "attribute", "in", "the", "specified", "jamfile", "module", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L603-L609
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.target
def target(self, project_module): """Returns the project target corresponding to the 'project-module'.""" assert isinstance(project_module, basestring) if project_module not in self.module2target: self.module2target[project_module] = \ b2.build.targets.ProjectTarget(p...
python
def target(self, project_module): """Returns the project target corresponding to the 'project-module'.""" assert isinstance(project_module, basestring) if project_module not in self.module2target: self.module2target[project_module] = \ b2.build.targets.ProjectTarget(p...
[ "def", "target", "(", "self", ",", "project_module", ")", ":", "assert", "isinstance", "(", "project_module", ",", "basestring", ")", "if", "project_module", "not", "in", "self", ".", "module2target", ":", "self", ".", "module2target", "[", "project_module", "...
Returns the project target corresponding to the 'project-module'.
[ "Returns", "the", "project", "target", "corresponding", "to", "the", "project", "-", "module", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L611-L619
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.add_rule
def add_rule(self, name, callable_): """Makes rule 'name' available to all subsequently loaded Jamfiles. Calling that rule wil relay to 'callable'.""" assert isinstance(name, basestring) assert callable(callable_) self.project_rules_.add_rule(name, callable_)
python
def add_rule(self, name, callable_): """Makes rule 'name' available to all subsequently loaded Jamfiles. Calling that rule wil relay to 'callable'.""" assert isinstance(name, basestring) assert callable(callable_) self.project_rules_.add_rule(name, callable_)
[ "def", "add_rule", "(", "self", ",", "name", ",", "callable_", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "assert", "callable", "(", "callable_", ")", "self", ".", "project_rules_", ".", "add_rule", "(", "name", ",", "callable_"...
Makes rule 'name' available to all subsequently loaded Jamfiles. Calling that rule wil relay to 'callable'.
[ "Makes", "rule", "name", "available", "to", "all", "subsequently", "loaded", "Jamfiles", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L639-L645
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.__build_python_module_cache
def __build_python_module_cache(self): """Recursively walks through the b2/src subdirectories and creates an index of base module name to package name. The index is stored within self.__python_module_cache and allows for an O(1) module lookup. For example, given the base module ...
python
def __build_python_module_cache(self): """Recursively walks through the b2/src subdirectories and creates an index of base module name to package name. The index is stored within self.__python_module_cache and allows for an O(1) module lookup. For example, given the base module ...
[ "def", "__build_python_module_cache", "(", "self", ")", ":", "cache", "=", "{", "}", "for", "importer", ",", "mname", ",", "ispkg", "in", "pkgutil", ".", "walk_packages", "(", "b2", ".", "__path__", ",", "prefix", "=", "'b2.'", ")", ":", "basename", "=",...
Recursively walks through the b2/src subdirectories and creates an index of base module name to package name. The index is stored within self.__python_module_cache and allows for an O(1) module lookup. For example, given the base module name `toolset`, self.__python_module_cache...
[ "Recursively", "walks", "through", "the", "b2", "/", "src", "subdirectories", "and", "creates", "an", "index", "of", "base", "module", "name", "to", "package", "name", ".", "The", "index", "is", "stored", "within", "self", ".", "__python_module_cache", "and", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L693-L724
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.load_module
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...
python
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", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "assert", "is_iterable_typed", "(", "extra_path", ",", "basestring", ")", "or", "extra_path", "is", "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 we have module named b2.package.module already. ...
[ "Load", "a", "Python", "module", "that", "should", "be", "useable", "from", "Jamfiles", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L726-L806
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectAttributes.set
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: ...
python
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", ")", ":", "assert", "isinstance", "(", "attribute", ",", "basestring", ")", "assert", "isinstance", "(", "exact", ",", "(", "int", ",", "bool", ")", ")", "if...
Set the named attribute from the specification given by the user. The value actually set may be different.
[ "Set", "the", "named", "attribute", "from", "the", "specification", "given", "by", "the", "user", ".", "The", "value", "actually", "set", "may", "be", "different", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L867-L944
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectAttributes.dump
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...
python
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", ")", ":", "id", "=", "self", ".", "get", "(", "\"id\"", ")", "if", "not", "id", ":", "id", "=", "\"(none)\"", "else", ":", "id", "=", "id", "[", "0", "]", "parent", "=", "self", ".", "get", "(", "\"parent\"", ")", ...
Prints the project attributes.
[ "Prints", "the", "project", "attributes", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L954-L973
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRules.make_wrapper
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...
python
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_", ")", ":", "assert", "callable", "(", "callable_", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kw", ")", ":", "return", "self", ".", "call_and_report_errors", "(", "callable_", ",", "*", ...
Given a free-standing function 'callable', return a new callable that will call 'callable' and report all exceptins, using 'call_and_report_errors'.
[ "Given", "a", "free", "-", "standing", "function", "callable", "return", "a", "new", "callable", "that", "will", "call", "callable", "and", "report", "all", "exceptins", "using", "call_and_report_errors", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L1044-L1051
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRules.constant
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...
python
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", ")", ":", "assert", "is_iterable_typed", "(", "name", ",", "basestring", ")", "assert", "is_iterable_typed", "(", "value", ",", "basestring", ")", "self", ".", "registry", ".", "current", "(", ")",...
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.
[ "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", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L1136-L1142
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRules.path_constant
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...
python
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", ")", ":", "assert", "is_iterable_typed", "(", "name", ",", "basestring", ")", "assert", "is_iterable_typed", "(", "value", ",", "basestring", ")", "if", "len", "(", "value", ")", ">", "1", "...
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.
[ "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", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L1144-L1153
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRules.conditional
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 : ...
python
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", ")", ":", "assert", "is_iterable_typed", "(", "condition", ",", "basestring", ")", "assert", "is_iterable_typed", "(", "requirements", ",", "basestring", ")", "c", "=", "string", ".", "j...
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 ...
[ "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", ":" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L1262-L1276
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/array_feature_extractor.py
create_array_feature_extractor
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...
python
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", ")", ":", "# Make sure that our starting stuff is in the proper form.", "assert", "len", "(", "input_features", ")", "==", "1", "as...
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.
[ "Creates", "a", "feature", "extractor", "from", "an", "input", "array", "feature", "return" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/array_feature_extractor.py#L16-L59
train
apple/turicreate
deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py
BuildOutputProcessor.add_input
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...
python
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", ")", ":", "events", "=", "xml", ".", "dom", ".", "pulldom", ".", "parse", "(", "input", ")", "context", "=", "[", "]", "for", "(", "event", ",", "node", ")", "in", "events", ":", "if", "event", "==",...
Add a single build XML output file to our data.
[ "Add", "a", "single", "build", "XML", "output", "file", "to", "our", "data", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py#L85-L103
train
apple/turicreate
deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py
BuildOutputProcessor.x_build_targets_target
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',...
python
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", ")", ":", "target_node", "=", "node", "name", "=", "self", ".", "get_child_data", "(", "target_node", ",", "tag", "=", "'name'", ",", "strip", "=", "True", ")", "path", "=", "self", ".", "get_chi...
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.
[ "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", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py#L146-L167
train
apple/turicreate
deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py
BuildOutputProcessor.x_build_action
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) ...
python
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", ")", ":", "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.
[ "Given", "a", "build", "action", "log", "process", "into", "the", "corresponding", "test", "log", "and", "specific", "test", "log", "sub", "-", "part", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py#L169-L233
train
apple/turicreate
deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py
BuildOutputProcessor.x_build_timestamp
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
python
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", ")", ":", "self", ".", "timestamps", ".", "append", "(", "self", ".", "get_data", "(", "node", ")", ".", "strip", "(", ")", ")", "return", "None" ]
The time-stamp goes to the corresponding attribute in the result.
[ "The", "time", "-", "stamp", "goes", "to", "the", "corresponding", "attribute", "in", "the", "result", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py#L235-L240
train
apple/turicreate
deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py
BuildConsoleSummaryReport.print_action
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...
python
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", ")", ":", "#self.info_print(\">>> {0}\",action.keys())", "if", "not", "test_succeed", "or", "action", "[", "'info'", "]", "[", "'always_show_run_output'", "]", ":", "output", "=", "action", "[...
Print the detailed info of failed or always print tests.
[ "Print", "the", "detailed", "info", "of", "failed", "or", "always", "print", "tests", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py#L363-L378
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/printer.py
_get_weight_param_summary
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...
python
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", ")", ":", "summary_str", "=", "''", "if", "wp", ".", "HasField", "(", "'quantization'", ")", ":", "nbits", "=", "wp", ".", "quantization", ".", "numberOfBits", "quant_type", "=", "'linearly'", "if", "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
[ "Get", "a", "summary", "of", "_NeuralNetwork_pb2", ".", "WeightParams", "Args", ":", "wp", ":", "_NeuralNetwork_pb2", ".", "WeightParams", "-", "the", "_NeuralNetwork_pb2", ".", "WeightParams", "message", "to", "display", "Returns", ":", "a", "str", "summary", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/printer.py#L8-L28
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/printer.py
_summarize_network_layer_info
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...
python
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", ")", ":", "layer_type_str", "=", "layer", ".", "WhichOneof", "(", "'layer'", ")", "layer_name", "=", "layer", ".", "name", "layer_inputs", "=", "list", "(", "layer", ".", "input", ")", "layer_outputs", "=",...
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 ...
[ "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", "["...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/printer.py#L67-L102
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/printer.py
summarize_neural_network_spec
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...
python
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", ")", ":", "inputs", "=", "[", "(", "blob", ".", "name", ",", "_get_feature_description_summary", "(", "blob", ")", ")", "for", "blob", "in", "mlmodel_spec", ".", "description", ".", "input", "]", "ou...
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...
[ "Summarize", "network", "into", "the", "following", "structure", ".", "Args", ":", "mlmodel_spec", ":", "mlmodel", "spec", "Returns", ":", "inputs", ":", "list", "[", "(", "str", "str", ")", "]", "-", "a", "list", "of", "two", "tuple", "(", "name", "de...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/printer.py#L105-L127
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/printer.py
print_network_spec
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('...
python
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", ")", ":", "inputs", ",", "outputs", ",", "layers_info", "=", "summarize_neural_network_spec", "(", "mlmodel_spec", ")", "print", "(", "'Inputs:'", ")", "for", "i", "in", "inpu...
Print the network information summary. Args: mlmodel_spec : the mlmodel spec interface_only : Shows only the input and output of the network
[ "Print", "the", "network", "information", "summary", ".", "Args", ":", "mlmodel_spec", ":", "the", "mlmodel", "spec", "interface_only", ":", "Shows", "only", "the", "input", "and", "output", "of", "the", "network" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/printer.py#L130-L163
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_SVC.py
_generate_base_svm_classifier_spec
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...
python
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", ")", ":", "if", "not", "(", "_HAS_SKLEARN", ")", ":", "raise", "RuntimeError", "(", "'scikit-learn not found. scikit-learn conversion API is disabled.'", ")", "check_fitted", "(", "model", ",", "lambda", "m", ":...
Takes an SVM classifier produces a starting spec using the parts. that are shared between all SVMs.
[ "Takes", "an", "SVM", "classifier", "produces", "a", "starting", "spec", "using", "the", "parts", ".", "that", "are", "shared", "between", "all", "SVMs", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_SVC.py#L24-L56
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_SVC.py
convert
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...
python
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", ")", ":", "if", "not", "(", "_HAS_SKLEARN", ")", ":", "raise", "RuntimeError", "(", "'scikit-learn not found. scikit-learn conversion API is disabled.'", ")", "spec", "=", "_generate_base_svm_classifie...
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...
[ "Convert", "a", "Support", "Vector", "Classtion", "(", "SVC", ")", "model", "to", "the", "protobuf", "spec", ".", "Parameters", "----------", "model", ":", "SVC", "A", "trained", "SVC", "encoder", "model", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_SVC.py#L58-L97
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py
NetGraph.make_input_layers
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...
python
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", ")", ":", "self", ".", "input_layers", "=", "[", "]", "if", "hasattr", "(", "self", ".", "model", ",", "'input_layers'", ")", ":", "input_keras_layers", "=", "self", ".", "model", ".", "input_layers", "[", ":", "]...
Extract the ordering of the input layers.
[ "Extract", "the", "ordering", "of", "the", "input", "layers", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py#L107-L129
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py
NetGraph.make_output_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,...
python
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", ")", ":", "# 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...
Extract the ordering of output layers.
[ "Extract", "the", "ordering", "of", "output", "layers", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py#L131-L144
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py
NetGraph.generate_blob_names
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...
python
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 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", ":"...
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.
[ "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", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py#L152-L174
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py
NetGraph._remove_layer
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...
python
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", ")", ":", "successors", "=", "self", ".", "get_successors", "(", "layer", ")", "predecessors", "=", "self", ".", "get_predecessors", "(", "layer", ")", "# remove all edges", "for", "succ", "in", "successors", ...
remove the layer and its input/output edges
[ "remove", "the", "layer", "and", "its", "input", "/", "output", "edges" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py#L295-L308
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py
NetGraph._insert_layer_after
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...
python
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", ")", ":", "# 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.", ...
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
[ "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" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py#L361-L378
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py
NetGraph._insert_layer_between
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...
python
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", ")", ":", "if", "snk", "is", "None", ":", "insert_pos", "=", "self", ".", "layer_list", ".", "index", "(", "src", ")", "+", "1", "else", ":",...
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
[ "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" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py#L380-L398
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py
NetGraph.defuse_activation
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...
python
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", ")", ":", "idx", ",", "nb_layers", "=", "0", ",", "len", "(", "self", ".", "layer_list", ")", "while", "idx", "<", "nb_layers", ":", "layer", "=", "self", ".", "layer_list", "[", "idx", "]", "k_layer", "=", "s...
Defuse the fused activation layers in the network.
[ "Defuse", "the", "fused", "activation", "layers", "in", "the", "network", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py#L400-L430
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py
NetGraph._get_1d_interface_edges
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. """ ...
python
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", ")", ":", "in_edges", "=", "[", "]", "for", "layer", "in", "self", ".", "layer_list", ":", "if", "not", "self", ".", "is_1d_layer", "(", "layer", ")", ":", "continue", "preds", "=", "self", ".", "get_predece...
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", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py#L446-L490
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py
NetGraph.insert_1d_permute_layers
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...
python
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", ")", ":", "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...
Insert permutation layers before a 1D start point or after 1D end point
[ "Insert", "permutation", "layers", "before", "a", "1D", "start", "point", "or", "after", "1D", "end", "point" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology.py#L492-L518
train
apple/turicreate
src/unity/python/turicreate/meta/asttools/mutators/replace_mutator.py
replace_nodes
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) ...
python
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", ")", ":", "rep", "=", "Replacer", "(", "old", ",", "new", ")", "rep", ".", "visit", "(", "root", ")", "return" ]
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
[ "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...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/asttools/mutators/replace_mutator.py#L49-L62
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/configure.py
log_component_configuration
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)
python
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", ")", ":", "assert", "isinstance", "(", "component", ",", "basestring", ")", "assert", "isinstance", "(", "message", ",", "basestring", ")", "__component_logs", ".", "setdefault", "(", "compone...
Report something about component configuration that the user should better know.
[ "Report", "something", "about", "component", "configuration", "that", "the", "user", "should", "better", "know", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/configure.py#L52-L56
train
apple/turicreate
src/unity/python/turicreate/toolkits/_feature_engineering/__init__.py
create
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...
python
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", ")", ":", "err_msg", "=", "\"The parameters 'transformers' must be a valid Transformer object.\"", "cls", "=", "transformers", ".", "__class__", "_raise_error_if_not_sframe", "(", "dataset", ",", "\"dataset\"", ")", "#...
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...
[ "Create", "a", "Transformer", "object", "to", "transform", "data", "for", "feature", "engineering", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/__init__.py#L47-L106
train
apple/turicreate
src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py
VGGishFeatureExtractor._preprocess_data
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...
python
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", ")", ":", "from", ".", "vggish_input", "import", "waveform_to_examples", "last_progress_update", "=", "_time", ".", "time", "(", ")", "progress_header_printed", "=", "False", "# Can't run as ...
Preprocess each example, breaking it up into frames. Returns two numpy arrays: preprocessed frame and their indexes
[ "Preprocess", "each", "example", "breaking", "it", "up", "into", "frames", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py#L40-L72
train
apple/turicreate
src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py
VGGishFeatureExtractor._extract_features
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...
python
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", ")", ":", "last_progress_update", "=", "_time", ".", "time", "(", ")", "progress_header_printed", "=", "False", "deep_features", "=", "_tc", ".", "SArrayBuilder", "("...
Parameters ---------- preprocessed_data : SArray Returns ------- numpy array containing the deep features
[ "Parameters", "----------", "preprocessed_data", ":", "SArray" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py#L112-L170
train
apple/turicreate
src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py
VGGishFeatureExtractor.get_deep_features
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...
python
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", ")", ":", "preprocessed_data", ",", "row_ids", "=", "self", ".", "_preprocess_data", "(", "audio_data", ",", "verbose", ")", "deep_features", "=", "self", ".", "_extract_features", "(", ...
Performs both audio preprocessing and VGGish deep feature extraction.
[ "Performs", "both", "audio", "preprocessing", "and", "VGGish", "deep", "feature", "extraction", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py#L172-L190
train
apple/turicreate
src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py
VGGishFeatureExtractor.get_spec
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...
python
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", ")", ":", "if", "_mac_ver", "(", ")", ">=", "(", "10", ",", "14", ")", ":", "return", "self", ".", "vggish_model", ".", "get_spec", "(", ")", "else", ":", "vggish_model_file", "=", "VGGish", "(", ")", "coreml_model_path"...
Return the Core ML spec
[ "Return", "the", "Core", "ML", "spec" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/_audio_feature_extractor.py#L192-L201
train
apple/turicreate
src/unity/python/turicreate/meta/asttools/mutators/remove_trivial.py
remove_trivial
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 ...
python
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", ")", ":", "gen", "=", "GatherAssignments", "(", ")", "gen", ".", "visit", "(", "root", ")", "to_remove", "=", "[", "]", "for", "symbol", ",", "assignments", "in", "gen", ".", "assign_id_map", ".", "items", "(", ")"...
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" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/asttools/mutators/remove_trivial.py#L78-L120
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/__init__.py
safe_isinstance
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 ...
python
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", ")", ":", "# inspect is being imported here because I seriously doubt", "# that this function will be used outside of the type", "# checking below.", "import", "inspect", "result...
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.
[ "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", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/__init__.py#L9-L36
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/__init__.py
value_to_jam
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 ...
python
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", ")", ":", "global", "__value_id", "r", "=", "__python_to_jam", ".", "get", "(", "value", ",", "None", ")", "if", "r", ":", "return", "r", "exported_name", "=", "'###_'", "+", "str", "("...
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_...
[ "Makes", "a", "token", "to", "refer", "to", "a", "Python", "value", "inside", "Jam", "language", "code", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/__init__.py#L228-L261
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/__init__.py
abbreviate_dashed
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)
python
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", ")", ":", "r", "=", "[", "]", "for", "part", "in", "s", ".", "split", "(", "'-'", ")", ":", "r", ".", "append", "(", "abbreviate", "(", "part", ")", ")", "return", "'-'", ".", "join", "(", "r", ")" ]
Abbreviates each part of string that is delimited by a '-'.
[ "Abbreviates", "each", "part", "of", "string", "that", "is", "delimited", "by", "a", "-", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/__init__.py#L281-L286
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/__init__.py
abbreviate
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 ...
python
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", ")", ":", "if", "not", "s", ":", "return", "''", "# check the cache", "if", "s", "in", "abbreviate", ".", "abbreviations", ":", "return", "abbreviate", ".", "abbreviations", "[", "s", "]", "# anything less than 4 characters doesn't...
Apply a set of standard transformations to string to produce an abbreviation no more than 4 characters long.
[ "Apply", "a", "set", "of", "standard", "transformations", "to", "string", "to", "produce", "an", "abbreviation", "no", "more", "than", "4", "characters", "long", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/__init__.py#L289-L319
train
apple/turicreate
src/unity/python/turicreate/toolkits/_decision_tree.py
Node.get_decision
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...
python
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", ")", ":", "# Child does exist and there is a path to the child.", "value", "=", "self", ".", "value", "feature", "=", "self", ".", "split_feature_column", "index", "=", "self", ".",...
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.
[ "Get", "the", "decision", "from", "this", "node", "to", "a", "child", "node", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_decision_tree.py#L80-L123
train
apple/turicreate
src/unity/python/turicreate/toolkits/_decision_tree.py
Node.to_dict
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...
python
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", ")", ":", "out", "=", "{", "}", "for", "key", "in", "self", ".", "__dict__", ".", "keys", "(", ")", ":", "if", "key", "not", "in", "[", "'left'", ",", "'right'", ",", "'missing'", ",", "'parent'", "]", ":", "out", ...
Return the node as a dictionary. Returns ------- dict: All the attributes of this node as a dictionary (minus the left and right).
[ "Return", "the", "node", "as", "a", "dictionary", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_decision_tree.py#L125-L138
train
apple/turicreate
src/unity/python/turicreate/toolkits/_decision_tree.py
DecisionTree.to_json
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...
python
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", "=", "{", "}", ")", ":", "_raise_error_if_not_of_type", "(", "root_id", ",", "[", "int", ",", "long", "]", ",", "\"root_id\"", ")", "_numeric_param_check_range", "(", "\"root_id\"", ",...
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...
[ "Recursive", "function", "to", "dump", "this", "tree", "as", "a", "json", "blob", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_decision_tree.py#L300-L371
train
apple/turicreate
src/unity/python/turicreate/toolkits/_decision_tree.py
DecisionTree.get_prediction_score
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...
python
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", ")", ":", "_raise_error_if_not_of_type", "(", "node_id", ",", "[", "int", ",", "long", "]", ",", "\"node_id\"", ")", "_numeric_param_check_range", "(", "\"node_id\"", ",", "node_id", ",", "0", ",", "s...
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. ...
[ "Return", "the", "prediction", "score", "(", "if", "leaf", "node", ")", "or", "None", "if", "its", "an", "intermediate", "node", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_decision_tree.py#L373-L401
train
apple/turicreate
src/unity/python/turicreate/toolkits/_decision_tree.py
DecisionTree.get_prediction_path
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...
python
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", "=", "[", "]", ")", ":", "_raise_error_if_not_of_type", "(", "node_id", ",", "[", "int", ",", "long", "]", ",", "\"node_id\"", ")", "_numeric_param_check_range", "(", "\"node_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. Returns ------- list: The list of decisions (top t...
[ "Return", "the", "prediction", "path", "from", "this", "node", "to", "the", "parent", "node", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_decision_tree.py#L403-L484
train
apple/turicreate
src/unity/python/turicreate/toolkits/graph_analytics/label_propagation.py
create
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...
python
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", "...
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...
[ "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", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/graph_analytics/label_propagation.py#L131-L274
train
apple/turicreate
src/unity/python/turicreate/_gl_pickle.py
_is_not_pickle_safe_gl_model_class
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...
python
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", ")", ":", "if", "issubclass", "(", "obj_class", ",", "_toolkits", ".", "_model", ".", "CustomModel", ")", ":", "return", "not", "obj_class", ".", "_is_gl_pickle_safe", "(", ")", "return", "False" ]
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.
[ "Check", "if", "a", "Turi", "create", "model", "is", "pickle", "safe", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L33-L50
train
apple/turicreate
src/unity/python/turicreate/_gl_pickle.py
_is_not_pickle_safe_gl_class
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 ---...
python
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", ")", ":", "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", "(", ...
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.
[ "Check", "if", "class", "is", "a", "Turi", "create", "model", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L52-L71
train
apple/turicreate
src/unity/python/turicreate/_gl_pickle.py
_get_gl_class_type
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...
python
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", ")", ":", "if", "obj_class", "==", "_SFrame", ":", "return", "\"SFrame\"", "elif", "obj_class", "==", "_SGraph", ":", "return", "\"SGraph\"", "elif", "obj_class", "==", "_SArray", ":", "return", "\"SArray\"", "elif"...
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.
[ "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", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L73-L97
train
apple/turicreate
src/unity/python/turicreate/_gl_pickle.py
_get_gl_object_from_persistent_id
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 ...
python
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", ")", ":", "if", "type_tag", "==", "\"SFrame\"", ":", "obj", "=", "_SFrame", "(", "gl_archive_abs_path", ")", "elif", "type_tag", "==", "\"SGraph\"", ":", "obj", "=", "_load_gr...
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 ---------- ...
[ "Internal", "util", "to", "get", "a", "GLC", "object", "from", "a", "persistent", "ID", "in", "the", "pickle", "file", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L99-L127
train
apple/turicreate
src/unity/python/turicreate/_gl_pickle.py
GLPickler.persistent_id
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...
python
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", ")", ":", "# 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...
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...
[ "Provide", "a", "persistent", "ID", "for", "saving", "GLC", "objects", "by", "reference", ".", "Return", "None", "for", "all", "non", "GLC", "objects", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L287-L351
train
apple/turicreate
src/unity/python/turicreate/_gl_pickle.py
GLPickler.close
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 = ...
python
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", ")", ":", "if", "self", ".", "file", "is", "None", ":", "return", "# Close the pickle file.", "self", ".", "file", ".", "close", "(", ")", "self", ".", "file", "=", "None", "for", "f", "in", "self", ".", "mark_for_delete", ...
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.
[ "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", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L353-L374
train
apple/turicreate
src/unity/python/turicreate/_gl_pickle.py
GLUnpickler.persistent_load
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. ...
python
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", ")", ":", "if", "len", "(", "pid", ")", "==", "2", ":", "# Pre GLC-1.3 release behavior, without memorization", "type_tag", ",", "filename", "=", "pid", "abs_path", "=", "_os", ".", "path", ".", "join", "(",...
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...
[ "Reconstruct", "a", "GLC", "object", "using", "the", "persistent", "ID", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L472-L500
train
apple/turicreate
src/unity/python/turicreate/_gl_pickle.py
GLUnpickler.close
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...
python
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", ")", ":", "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", ...
Clean up files that were created.
[ "Clean", "up", "files", "that", "were", "created", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_gl_pickle.py#L502-L514
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_converter.py
convert
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. ...
python
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", ")", ":", "# This function is just a thin wrapper around the internal converter so", "# that sklearn isn't actually imported unless this function is called", "from", ".", ...
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, ...
[ "Convert", "scikit", "-", "learn", "pipeline", "classifier", "or", "regressor", "to", "Core", "ML", "format", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_converter.py#L10-L148
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/reflection.py
ParseMessage
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...
python
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", ")", ":", "result_class", "=", "MakeClass", "(", "descriptor", ")", "new_msg", "=", "result_class", "(", ")", "new_msg", ".", "ParseFromString", "(", "byte_str", ")", "return", "new_msg" ]
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.
[ "Generate", "a", "new", "Message", "instance", "from", "this", "Descriptor", "and", "a", "byte", "string", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/reflection.py#L67-L80
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/reflection.py
MakeClass
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...
python
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", ")", ":", "if", "descriptor", "in", "MESSAGE_CLASS_CACHE", ":", "return", "MESSAGE_CLASS_CACHE", "[", "descriptor", "]", "attributes", "=", "{", "}", "for", "name", ",", "nested_type", "in", "descriptor", ".", "nested_types...
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...
[ "Construct", "a", "class", "object", "for", "a", "protobuf", "described", "by", "descriptor", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/reflection.py#L83-L121
train
apple/turicreate
src/unity/python/turicreate/toolkits/image_analysis/image_analysis.py
load_images
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' | ...
python
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", ")", ":", "from", ".", ".", ".", "import", "extensions", ...
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...
[ "Loads", "images", "from", "a", "directory", ".", "JPEG", "and", "PNG", "images", "are", "supported", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_analysis/image_analysis.py#L12-L60
train
apple/turicreate
src/unity/python/turicreate/toolkits/image_analysis/image_analysis.py
_decode
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...
python
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", ")", ":", "from", ".", ".", ".", "data_structures", ".", "sarray", "import", "SArray", "as", "_SArray", "from", ".", ".", ".", "import", "extensions", "as", "_extensions", "if", "type", "(", "image_data", ")", "is", "...
Internal helper function for decoding a single Image or an SArray of Images
[ "Internal", "helper", "function", "for", "decoding", "a", "single", "Image", "or", "an", "SArray", "of", "Images" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_analysis/image_analysis.py#L63-L72
train
apple/turicreate
src/unity/python/turicreate/toolkits/image_analysis/image_analysis.py
resize
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...
python
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'", ")", ":", "if", "height", "<", "0", "or", "width", "<", "0", ":", "raise", "ValueError", "(", ...
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...
[ "Resizes", "the", "image", "or", "SArray", "of", "Images", "to", "a", "specific", "width", "height", "and", "number", "of", "channels", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_analysis/image_analysis.py#L76-L161
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
_convert_1bit_array_to_byte_array
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(...
python
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", ")", ":", "# Padding if necessary", "while", "len", "(", "arr", ")", "<", "8", "or", "len", "(", "arr", ")", "%", "8", ":", "arr", ".", "append", "(", "0", ")", "arr", "=", "_np", ".", "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
[ "Convert", "bit", "array", "to", "byte", "array", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L34-L65
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
_decompose_bytes_to_bit_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)): ...
python
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", ")", ":", "bit_arr", "=", "[", "]", "for", "idx", "in", "range", "(", "len", "(", "arr", ")", ")", ":", "for", "i", "in", "reversed", "(", "range", "(", "8", ")", ")", ":", "bit_arr", ".", "append",...
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)
[ "Unpack", "bytes", "to", "bits" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L77-L93
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
_get_linear_lookup_table_and_weight
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 ...
python
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", ")", ":", "w", "=", "wp", ".", "reshape", "(", "1", ",", "-", "1", ")", "qw", ",", "scales", ",", "biases", "=", "_quantize_channelwise_linear", "(", "w", ",", "nbits", ",", "axis", ...
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 ...
[ "Generate", "a", "linear", "lookup", "table", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L96-L117
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
_get_kmeans_lookup_table_and_weight
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...
python
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", ")", ":", "if", "_HAS_SKLEARN", ":", "from", "sklearn", ".", "cluster", "...
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...
[ "Generate", "K", "-", "Means", "lookup", "table", "given", "a", "weight", "parameter", "field" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L120-L149
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
_quantize_channelwise_linear
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,...
python
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", ")", ":", "if", "len", "(", "weight", ".", "shape", ")", "==", "1", ":", "# vector situation, treat as 1 channel", "weight", "=", "weight", ".", "reshape", "(", "(", ...
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...
[ "Linearly", "quantize", "weight", "blob", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L151-L212
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
_quantize_wp
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...
python
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", ")", ":", "scale", "=", "bias", "=", "lut", "=", "None", "# Linear Quantization", "if", "qm", "==", "_QUANTIZATION_MODE_LINEAR_QUANTIZATION", ":", ...
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 ...
[ "Quantize", "the", "weight", "blob" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L215-L266
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
_quantize_wp_field
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...
python
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", ")", ":", "# De-quantization", "if", "qm", "==", "_QUANTIZATION_MODE_DEQUANTIZE", ":", "return", "_dequantize_wp", "(", "wp", ","...
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 ...
[ "Quantize", "WeightParam", "field", "in", "Neural", "Network", "Protobuf" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L269-L336
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
compare_models
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...
python
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", ")", ":", "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\"\"\"...
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] ...
[ "Utility", "function", "to", "compare", "the", "performance", "of", "a", "full", "precision", "vs", "quantized", "model" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L829-L874
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py
quantize_weights
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...
python
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", ")", ":", "qmode_mapping", "=", "{", "\"linear\"", ":", "_QUANTIZATION_MODE_LINEAR_QUANTIZATI...
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...
[ "Utility", "function", "to", "convert", "a", "full", "precision", "(", "float", ")", "MLModel", "to", "a", "nbit", "quantized", "MLModel", "(", "float16", ")", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/quantization_utils.py#L877-L977
train
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/item_similarity_recommender.py
create
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...
python
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",...
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...
[ "Create", "a", "recommender", "that", "uses", "item", "-", "item", "similarities", "based", "on", "users", "in", "common", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/item_similarity_recommender.py#L17-L259
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
_get_elementwise_name_from_keras_layer
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...
python
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", ")", ":", "if", "isinstance", "(", "keras_layer", ",", "_keras", ".", "layers", ".", "Add", ")", ":", "return", "'ADD'", "elif", "isinstance", "(", "keras_layer", ",", "_keras", ".", "layers", ...
Get the keras layer name from the activation name.
[ "Get", "the", "keras", "layer", "name", "from", "the", "activation", "name", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L76-L117
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
convert_dense
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...
python
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", ")", ":", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", "0", ...
Convert a dense layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
[ "Convert", "a", "dense", "layer", "from", "keras", "to", "coreml", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L137-L165
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
convert_embedding
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...
python
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", ")", ":", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", "...
Convert a dense layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
[ "Convert", "a", "dense", "layer", "from", "keras", "to", "coreml", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L167-L192
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
convert_activation
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 ...
python
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", ")", ":", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", ...
Convert an activation layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
[ "Convert", "an", "activation", "layer", "from", "keras", "to", "coreml", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L194-L267
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
convert_advanced_relu
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. ...
python
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", ")", ":", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[",...
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", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L269-L302
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
convert_convolution
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...
python
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", ")", ":", "_check_data_format", "(", "keras_layer", ")", "# Get input and output names", "input_name", ",", "output_name", "=", "(", "input_names",...
Convert convolution layer from keras to coreml. Parameters ---------- keras_layer: layer A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
[ "Convert", "convolution", "layer", "from", "keras", "to", "coreml", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L304-L383
train