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 | deps/src/boost_1_68_0/tools/build/src/build/feature.py | implied_feature | def implied_feature (implicit_value):
""" Returns the implicit feature associated with the given implicit value.
"""
assert isinstance(implicit_value, basestring)
components = implicit_value.split('-')
if components[0] not in __implicit_features:
raise InvalidValue ("'%s' is not a value of ... | python | def implied_feature (implicit_value):
""" Returns the implicit feature associated with the given implicit value.
"""
assert isinstance(implicit_value, basestring)
components = implicit_value.split('-')
if components[0] not in __implicit_features:
raise InvalidValue ("'%s' is not a value of ... | [
"def",
"implied_feature",
"(",
"implicit_value",
")",
":",
"assert",
"isinstance",
"(",
"implicit_value",
",",
"basestring",
")",
"components",
"=",
"implicit_value",
".",
"split",
"(",
"'-'",
")",
"if",
"components",
"[",
"0",
"]",
"not",
"in",
"__implicit_fe... | Returns the implicit feature associated with the given implicit value. | [
"Returns",
"the",
"implicit",
"feature",
"associated",
"with",
"the",
"given",
"implicit",
"value",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L243-L252 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | validate_feature | def validate_feature (name):
""" Checks if all name is a valid feature. Otherwise, raises an exception.
"""
assert isinstance(name, basestring)
if name not in __all_features:
raise InvalidFeature ("'%s' is not a valid feature name" % name)
else:
return __all_features[name] | python | def validate_feature (name):
""" Checks if all name is a valid feature. Otherwise, raises an exception.
"""
assert isinstance(name, basestring)
if name not in __all_features:
raise InvalidFeature ("'%s' is not a valid feature name" % name)
else:
return __all_features[name] | [
"def",
"validate_feature",
"(",
"name",
")",
":",
"assert",
"isinstance",
"(",
"name",
",",
"basestring",
")",
"if",
"name",
"not",
"in",
"__all_features",
":",
"raise",
"InvalidFeature",
"(",
"\"'%s' is not a valid feature name\"",
"%",
"name",
")",
"else",
":"... | Checks if all name is a valid feature. Otherwise, raises an exception. | [
"Checks",
"if",
"all",
"name",
"is",
"a",
"valid",
"feature",
".",
"Otherwise",
"raises",
"an",
"exception",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L281-L288 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | __expand_subfeatures_aux | def __expand_subfeatures_aux (property_, dont_validate = False):
""" Helper for expand_subfeatures.
Given a feature and value, or just a value corresponding to an
implicit feature, returns a property set consisting of all component
subfeatures and their values. For example:
expand... | python | def __expand_subfeatures_aux (property_, dont_validate = False):
""" Helper for expand_subfeatures.
Given a feature and value, or just a value corresponding to an
implicit feature, returns a property set consisting of all component
subfeatures and their values. For example:
expand... | [
"def",
"__expand_subfeatures_aux",
"(",
"property_",
",",
"dont_validate",
"=",
"False",
")",
":",
"from",
".",
"import",
"property",
"# no __debug__ since Property is used elsewhere",
"assert",
"isinstance",
"(",
"property_",
",",
"property",
".",
"Property",
")",
"a... | Helper for expand_subfeatures.
Given a feature and value, or just a value corresponding to an
implicit feature, returns a property set consisting of all component
subfeatures and their values. For example:
expand_subfeatures <toolset>gcc-2.95.2-linux-x86
-> <toolset>gcc ... | [
"Helper",
"for",
"expand_subfeatures",
".",
"Given",
"a",
"feature",
"and",
"value",
"or",
"just",
"a",
"value",
"corresponding",
"to",
"an",
"implicit",
"feature",
"returns",
"a",
"property",
"set",
"consisting",
"of",
"all",
"component",
"subfeatures",
"and",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L292-L336 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | expand_subfeatures | def expand_subfeatures(properties, dont_validate = False):
"""
Make all elements of properties corresponding to implicit features
explicit, and express all subfeature values as separate properties
in their own right. For example, the property
gcc-2.95.2-linux-x86
might expand to
<too... | python | def expand_subfeatures(properties, dont_validate = False):
"""
Make all elements of properties corresponding to implicit features
explicit, and express all subfeature values as separate properties
in their own right. For example, the property
gcc-2.95.2-linux-x86
might expand to
<too... | [
"def",
"expand_subfeatures",
"(",
"properties",
",",
"dont_validate",
"=",
"False",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"assert",
"isinstance",
"... | Make all elements of properties corresponding to implicit features
explicit, and express all subfeature values as separate properties
in their own right. For example, the property
gcc-2.95.2-linux-x86
might expand to
<toolset>gcc <toolset-version>2.95.2 <toolset-os>linux <toolset-cpu>x86
... | [
"Make",
"all",
"elements",
"of",
"properties",
"corresponding",
"to",
"implicit",
"features",
"explicit",
"and",
"express",
"all",
"subfeature",
"values",
"as",
"separate",
"properties",
"in",
"their",
"own",
"right",
".",
"For",
"example",
"the",
"property"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L338-L367 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | extend | def extend (name, values):
""" Adds the given values to the given feature.
"""
assert isinstance(name, basestring)
assert is_iterable_typed(values, basestring)
name = add_grist (name)
__validate_feature (name)
feature = __all_features [name]
if feature.implicit:
for v in values:... | python | def extend (name, values):
""" Adds the given values to the given feature.
"""
assert isinstance(name, basestring)
assert is_iterable_typed(values, basestring)
name = add_grist (name)
__validate_feature (name)
feature = __all_features [name]
if feature.implicit:
for v in values:... | [
"def",
"extend",
"(",
"name",
",",
"values",
")",
":",
"assert",
"isinstance",
"(",
"name",
",",
"basestring",
")",
"assert",
"is_iterable_typed",
"(",
"values",
",",
"basestring",
")",
"name",
"=",
"add_grist",
"(",
"name",
")",
"__validate_feature",
"(",
... | Adds the given values to the given feature. | [
"Adds",
"the",
"given",
"values",
"to",
"the",
"given",
"feature",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L389-L410 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | validate_value_string | def validate_value_string (f, value_string):
""" Checks that value-string is a valid value-string for the given feature.
"""
assert isinstance(f, Feature)
assert isinstance(value_string, basestring)
if f.free or value_string in f.values:
return
values = [value_string]
if f.subfeatu... | python | def validate_value_string (f, value_string):
""" Checks that value-string is a valid value-string for the given feature.
"""
assert isinstance(f, Feature)
assert isinstance(value_string, basestring)
if f.free or value_string in f.values:
return
values = [value_string]
if f.subfeatu... | [
"def",
"validate_value_string",
"(",
"f",
",",
"value_string",
")",
":",
"assert",
"isinstance",
"(",
"f",
",",
"Feature",
")",
"assert",
"isinstance",
"(",
"value_string",
",",
"basestring",
")",
"if",
"f",
".",
"free",
"or",
"value_string",
"in",
"f",
".... | Checks that value-string is a valid value-string for the given feature. | [
"Checks",
"that",
"value",
"-",
"string",
"is",
"a",
"valid",
"value",
"-",
"string",
"for",
"the",
"given",
"feature",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L412-L434 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | subfeature | def subfeature (feature_name, value_string, subfeature, subvalues, attributes = []):
""" Declares a subfeature.
feature_name: Root feature that is not a subfeature.
value_string: An optional value-string specifying which feature or
subfeature values this subfeature is spe... | python | def subfeature (feature_name, value_string, subfeature, subvalues, attributes = []):
""" Declares a subfeature.
feature_name: Root feature that is not a subfeature.
value_string: An optional value-string specifying which feature or
subfeature values this subfeature is spe... | [
"def",
"subfeature",
"(",
"feature_name",
",",
"value_string",
",",
"subfeature",
",",
"subvalues",
",",
"attributes",
"=",
"[",
"]",
")",
":",
"parent_feature",
"=",
"validate_feature",
"(",
"feature_name",
")",
"# Add grist to the subfeature name if a value-string was... | Declares a subfeature.
feature_name: Root feature that is not a subfeature.
value_string: An optional value-string specifying which feature or
subfeature values this subfeature is specific to,
if any.
subfeature: The name of the subfeature ... | [
"Declares",
"a",
"subfeature",
".",
"feature_name",
":",
"Root",
"feature",
"that",
"is",
"not",
"a",
"subfeature",
".",
"value_string",
":",
"An",
"optional",
"value",
"-",
"string",
"specifying",
"which",
"feature",
"or",
"subfeature",
"values",
"this",
"sub... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L482-L509 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | compose | def compose (composite_property_s, component_properties_s):
""" Sets the components of the given composite property.
All parameters are <feature>value strings
"""
from . import property
component_properties_s = to_seq (component_properties_s)
composite_property = property.create_from_string(co... | python | def compose (composite_property_s, component_properties_s):
""" Sets the components of the given composite property.
All parameters are <feature>value strings
"""
from . import property
component_properties_s = to_seq (component_properties_s)
composite_property = property.create_from_string(co... | [
"def",
"compose",
"(",
"composite_property_s",
",",
"component_properties_s",
")",
":",
"from",
".",
"import",
"property",
"component_properties_s",
"=",
"to_seq",
"(",
"component_properties_s",
")",
"composite_property",
"=",
"property",
".",
"create_from_string",
"(",... | Sets the components of the given composite property.
All parameters are <feature>value strings | [
"Sets",
"the",
"components",
"of",
"the",
"given",
"composite",
"property",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L513-L538 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | get_values | def get_values (feature, properties):
""" Returns all values of the given feature specified by the given property set.
"""
if feature[0] != '<':
feature = '<' + feature + '>'
result = []
for p in properties:
if get_grist (p) == feature:
result.append (replace_grist (p, ''))
... | python | def get_values (feature, properties):
""" Returns all values of the given feature specified by the given property set.
"""
if feature[0] != '<':
feature = '<' + feature + '>'
result = []
for p in properties:
if get_grist (p) == feature:
result.append (replace_grist (p, ''))
... | [
"def",
"get_values",
"(",
"feature",
",",
"properties",
")",
":",
"if",
"feature",
"[",
"0",
"]",
"!=",
"'<'",
":",
"feature",
"=",
"'<'",
"+",
"feature",
"+",
"'>'",
"result",
"=",
"[",
"]",
"for",
"p",
"in",
"properties",
":",
"if",
"get_grist",
... | Returns all values of the given feature specified by the given property set. | [
"Returns",
"all",
"values",
"of",
"the",
"given",
"feature",
"specified",
"by",
"the",
"given",
"property",
"set",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L552-L562 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | expand_composites | def expand_composites (properties):
""" Expand all composite properties in the set so that all components
are explicitly expressed.
"""
if __debug__:
from .property import Property
assert is_iterable_typed(properties, Property)
explicit_features = set(p.feature for p in propertie... | python | def expand_composites (properties):
""" Expand all composite properties in the set so that all components
are explicitly expressed.
"""
if __debug__:
from .property import Property
assert is_iterable_typed(properties, Property)
explicit_features = set(p.feature for p in propertie... | [
"def",
"expand_composites",
"(",
"properties",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"explicit_features",
"=",
"set",
"(",
"p",
".",
"feature",
"... | Expand all composite properties in the set so that all components
are explicitly expressed. | [
"Expand",
"all",
"composite",
"properties",
"in",
"the",
"set",
"so",
"that",
"all",
"components",
"are",
"explicitly",
"expressed",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L569-L606 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | is_subfeature_of | def is_subfeature_of (parent_property, f):
""" Return true iff f is an ordinary subfeature of the parent_property's
feature, or if f is a subfeature of the parent_property's feature
specific to the parent_property's value.
"""
if __debug__:
from .property import Property
asse... | python | def is_subfeature_of (parent_property, f):
""" Return true iff f is an ordinary subfeature of the parent_property's
feature, or if f is a subfeature of the parent_property's feature
specific to the parent_property's value.
"""
if __debug__:
from .property import Property
asse... | [
"def",
"is_subfeature_of",
"(",
"parent_property",
",",
"f",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"isinstance",
"(",
"parent_property",
",",
"Property",
")",
"assert",
"isinstance",
"(",
"f",
",",
"Feature"... | Return true iff f is an ordinary subfeature of the parent_property's
feature, or if f is a subfeature of the parent_property's feature
specific to the parent_property's value. | [
"Return",
"true",
"iff",
"f",
"is",
"an",
"ordinary",
"subfeature",
"of",
"the",
"parent_property",
"s",
"feature",
"or",
"if",
"f",
"is",
"a",
"subfeature",
"of",
"the",
"parent_property",
"s",
"feature",
"specific",
"to",
"the",
"parent_property",
"s",
"va... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L609-L635 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | __is_subproperty_of | def __is_subproperty_of (parent_property, p):
""" As is_subfeature_of, for subproperties.
"""
if __debug__:
from .property import Property
assert isinstance(parent_property, Property)
assert isinstance(p, Property)
return is_subfeature_of (parent_property, p.feature) | python | def __is_subproperty_of (parent_property, p):
""" As is_subfeature_of, for subproperties.
"""
if __debug__:
from .property import Property
assert isinstance(parent_property, Property)
assert isinstance(p, Property)
return is_subfeature_of (parent_property, p.feature) | [
"def",
"__is_subproperty_of",
"(",
"parent_property",
",",
"p",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"isinstance",
"(",
"parent_property",
",",
"Property",
")",
"assert",
"isinstance",
"(",
"p",
",",
"Prope... | As is_subfeature_of, for subproperties. | [
"As",
"is_subfeature_of",
"for",
"subproperties",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L637-L644 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | expand | def expand (properties):
""" Given a property set which may consist of composite and implicit
properties and combined subfeature values, returns an expanded,
normalized property set with all implicit features expressed
explicitly, all subfeature values individually expressed, and all
... | python | def expand (properties):
""" Given a property set which may consist of composite and implicit
properties and combined subfeature values, returns an expanded,
normalized property set with all implicit features expressed
explicitly, all subfeature values individually expressed, and all
... | [
"def",
"expand",
"(",
"properties",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"expanded",
"=",
"expand_subfeatures",
"(",
"properties",
")",
"return",
... | Given a property set which may consist of composite and implicit
properties and combined subfeature values, returns an expanded,
normalized property set with all implicit features expressed
explicitly, all subfeature values individually expressed, and all
components of composite properti... | [
"Given",
"a",
"property",
"set",
"which",
"may",
"consist",
"of",
"composite",
"and",
"implicit",
"properties",
"and",
"combined",
"subfeature",
"values",
"returns",
"an",
"expanded",
"normalized",
"property",
"set",
"with",
"all",
"implicit",
"features",
"express... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L664-L679 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | add_defaults | def add_defaults (properties):
""" Given a set of properties, add default values for features not
represented in the set.
Note: if there's there's ordinary feature F1 and composite feature
F2, which includes some value for F1, and both feature have default values,
then the default va... | python | def add_defaults (properties):
""" Given a set of properties, add default values for features not
represented in the set.
Note: if there's there's ordinary feature F1 and composite feature
F2, which includes some value for F1, and both feature have default values,
then the default va... | [
"def",
"add_defaults",
"(",
"properties",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"# create a copy since properties will be modified",
"result",
"=",
"list... | Given a set of properties, add default values for features not
represented in the set.
Note: if there's there's ordinary feature F1 and composite feature
F2, which includes some value for F1, and both feature have default values,
then the default value of F1 will be added, not the value ... | [
"Given",
"a",
"set",
"of",
"properties",
"add",
"default",
"values",
"for",
"features",
"not",
"represented",
"in",
"the",
"set",
".",
"Note",
":",
"if",
"there",
"s",
"there",
"s",
"ordinary",
"feature",
"F1",
"and",
"composite",
"feature",
"F2",
"which",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L682-L722 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | minimize | def minimize (properties):
""" Given an expanded property set, eliminate all redundancy: properties
which are elements of other (composite) properties in the set will
be eliminated. Non-symmetric properties equal to default values will be
eliminated, unless the override a value from some com... | python | def minimize (properties):
""" Given an expanded property set, eliminate all redundancy: properties
which are elements of other (composite) properties in the set will
be eliminated. Non-symmetric properties equal to default values will be
eliminated, unless the override a value from some com... | [
"def",
"minimize",
"(",
"properties",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"# remove properties implied by composite features",
"components",
"=",
"[",
... | Given an expanded property set, eliminate all redundancy: properties
which are elements of other (composite) properties in the set will
be eliminated. Non-symmetric properties equal to default values will be
eliminated, unless the override a value from some composite property.
Implicit p... | [
"Given",
"an",
"expanded",
"property",
"set",
"eliminate",
"all",
"redundancy",
":",
"properties",
"which",
"are",
"elements",
"of",
"other",
"(",
"composite",
")",
"properties",
"in",
"the",
"set",
"will",
"be",
"eliminated",
".",
"Non",
"-",
"symmetric",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L724-L783 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | split | def split (properties):
""" Given a property-set of the form
v1/v2/...vN-1/<fN>vN/<fN+1>vN+1/...<fM>vM
Returns
v1 v2 ... vN-1 <fN>vN <fN+1>vN+1 ... <fM>vM
Note that vN...vM may contain slashes. This is resilient to the
substitution of backslashes for slashes, since Jam, unbidden,
s... | python | def split (properties):
""" Given a property-set of the form
v1/v2/...vN-1/<fN>vN/<fN+1>vN+1/...<fM>vM
Returns
v1 v2 ... vN-1 <fN>vN <fN+1>vN+1 ... <fM>vM
Note that vN...vM may contain slashes. This is resilient to the
substitution of backslashes for slashes, since Jam, unbidden,
s... | [
"def",
"split",
"(",
"properties",
")",
":",
"assert",
"isinstance",
"(",
"properties",
",",
"basestring",
")",
"def",
"split_one",
"(",
"properties",
")",
":",
"pieces",
"=",
"re",
".",
"split",
"(",
"__re_slash_or_backslash",
",",
"properties",
")",
"resul... | Given a property-set of the form
v1/v2/...vN-1/<fN>vN/<fN+1>vN+1/...<fM>vM
Returns
v1 v2 ... vN-1 <fN>vN <fN+1>vN+1 ... <fM>vM
Note that vN...vM may contain slashes. This is resilient to the
substitution of backslashes for slashes, since Jam, unbidden,
sometimes swaps slash direction o... | [
"Given",
"a",
"property",
"-",
"set",
"of",
"the",
"form",
"v1",
"/",
"v2",
"/",
"...",
"vN",
"-",
"1",
"/",
"<fN",
">",
"vN",
"/",
"<fN",
"+",
"1",
">",
"vN",
"+",
"1",
"/",
"...",
"<fM",
">",
"vM"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L786-L816 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | compress_subproperties | def compress_subproperties (properties):
""" Combine all subproperties into their parent properties
Requires: for every subproperty, there is a parent property. All
features are explicitly expressed.
This rule probably shouldn't be needed, but
build-request.expand-no-defaults is b... | python | def compress_subproperties (properties):
""" Combine all subproperties into their parent properties
Requires: for every subproperty, there is a parent property. All
features are explicitly expressed.
This rule probably shouldn't be needed, but
build-request.expand-no-defaults is b... | [
"def",
"compress_subproperties",
"(",
"properties",
")",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"result",
"=",
"[",
"]",
"matched_subs",
"=",
"set",
"(",
")",
"all_subs",
"=",... | Combine all subproperties into their parent properties
Requires: for every subproperty, there is a parent property. All
features are explicitly expressed.
This rule probably shouldn't be needed, but
build-request.expand-no-defaults is being abused for unintended
purposes and i... | [
"Combine",
"all",
"subproperties",
"into",
"their",
"parent",
"properties"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L819-L856 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/feature.py | __select_subfeatures | def __select_subfeatures (parent_property, features):
""" Given a property, return the subset of features consisting of all
ordinary subfeatures of the property's feature, and all specific
subfeatures of the property's feature which are conditional on the
property's value.
"""
if __d... | python | def __select_subfeatures (parent_property, features):
""" Given a property, return the subset of features consisting of all
ordinary subfeatures of the property's feature, and all specific
subfeatures of the property's feature which are conditional on the
property's value.
"""
if __d... | [
"def",
"__select_subfeatures",
"(",
"parent_property",
",",
"features",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property",
"import",
"Property",
"assert",
"isinstance",
"(",
"parent_property",
",",
"Property",
")",
"assert",
"is_iterable_typed",
"(",
"feat... | Given a property, return the subset of features consisting of all
ordinary subfeatures of the property's feature, and all specific
subfeatures of the property's feature which are conditional on the
property's value. | [
"Given",
"a",
"property",
"return",
"the",
"subset",
"of",
"features",
"consisting",
"of",
"all",
"ordinary",
"subfeatures",
"of",
"the",
"property",
"s",
"feature",
"and",
"all",
"specific",
"subfeatures",
"of",
"the",
"property",
"s",
"feature",
"which",
"ar... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/feature.py#L902-L912 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | _get_interpretation_function | def _get_interpretation_function(interpretation, dtype):
"""
Retrieves the interpretation function used.
"""
type_string = dtype.__name__
name = "%s__%s" % (interpretation, type_string)
global _interpretations
if not hasattr(_interpretations, name):
raise ValueError("No transform ... | python | def _get_interpretation_function(interpretation, dtype):
"""
Retrieves the interpretation function used.
"""
type_string = dtype.__name__
name = "%s__%s" % (interpretation, type_string)
global _interpretations
if not hasattr(_interpretations, name):
raise ValueError("No transform ... | [
"def",
"_get_interpretation_function",
"(",
"interpretation",
",",
"dtype",
")",
":",
"type_string",
"=",
"dtype",
".",
"__name__",
"name",
"=",
"\"%s__%s\"",
"%",
"(",
"interpretation",
",",
"type_string",
")",
"global",
"_interpretations",
"if",
"not",
"hasattr"... | Retrieves the interpretation function used. | [
"Retrieves",
"the",
"interpretation",
"function",
"used",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L380-L394 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | _get_interpretation_description_and_output_type | def _get_interpretation_description_and_output_type(interpretation, dtype):
"""
Returns the description and output type for a given interpretation.
"""
type_string = dtype.__name__
name = "%s__%s" % (interpretation, type_string)
if not hasattr(_interpretations_class, name):
raise Value... | python | def _get_interpretation_description_and_output_type(interpretation, dtype):
"""
Returns the description and output type for a given interpretation.
"""
type_string = dtype.__name__
name = "%s__%s" % (interpretation, type_string)
if not hasattr(_interpretations_class, name):
raise Value... | [
"def",
"_get_interpretation_description_and_output_type",
"(",
"interpretation",
",",
"dtype",
")",
":",
"type_string",
"=",
"dtype",
".",
"__name__",
"name",
"=",
"\"%s__%s\"",
"%",
"(",
"interpretation",
",",
"type_string",
")",
"if",
"not",
"hasattr",
"(",
"_in... | Returns the description and output type for a given interpretation. | [
"Returns",
"the",
"description",
"and",
"output",
"type",
"for",
"a",
"given",
"interpretation",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L396-L411 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | _get_embeddable_interpretation_doc | def _get_embeddable_interpretation_doc(indent = 0):
"""
Returns a list of the available interpretations and what they do.
If indent is specified, then the entire doc string is indented by that amount.
"""
output_rows = []
# Pull out the doc string and put it in a table.
for name in sorted... | python | def _get_embeddable_interpretation_doc(indent = 0):
"""
Returns a list of the available interpretations and what they do.
If indent is specified, then the entire doc string is indented by that amount.
"""
output_rows = []
# Pull out the doc string and put it in a table.
for name in sorted... | [
"def",
"_get_embeddable_interpretation_doc",
"(",
"indent",
"=",
"0",
")",
":",
"output_rows",
"=",
"[",
"]",
"# Pull out the doc string and put it in a table.",
"for",
"name",
"in",
"sorted",
"(",
"dir",
"(",
"_interpretations",
")",
")",
":",
"if",
"name",
".",
... | Returns a list of the available interpretations and what they do.
If indent is specified, then the entire doc string is indented by that amount. | [
"Returns",
"a",
"list",
"of",
"the",
"available",
"interpretations",
"and",
"what",
"they",
"do",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L413-L436 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | _ColumnFunctionTransformation._load_version | def _load_version(cls, unpickler, version):
"""
A function to load a previously saved SentenceSplitter instance.
Parameters
----------
unpickler : GLUnpickler
A GLUnpickler file handler.
version : int
Version number maintained by the class writer... | python | def _load_version(cls, unpickler, version):
"""
A function to load a previously saved SentenceSplitter instance.
Parameters
----------
unpickler : GLUnpickler
A GLUnpickler file handler.
version : int
Version number maintained by the class writer... | [
"def",
"_load_version",
"(",
"cls",
",",
"unpickler",
",",
"version",
")",
":",
"state",
",",
"_exclude",
",",
"_features",
"=",
"unpickler",
".",
"load",
"(",
")",
"features",
"=",
"state",
"[",
"'features'",
"]",
"excluded_features",
"=",
"state",
"[",
... | A function to load a previously saved SentenceSplitter instance.
Parameters
----------
unpickler : GLUnpickler
A GLUnpickler file handler.
version : int
Version number maintained by the class writer. | [
"A",
"function",
"to",
"load",
"a",
"previously",
"saved",
"SentenceSplitter",
"instance",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L72-L95 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | _ColumnFunctionTransformation.fit | def fit(self, data):
"""
Fits the transformer using the given data.
"""
_raise_error_if_not_sframe(data, "data")
fitted_state = {}
feature_columns = _internal_utils.get_column_names(data, self._exclude, self._features)
if not feature_columns:
raise ... | python | def fit(self, data):
"""
Fits the transformer using the given data.
"""
_raise_error_if_not_sframe(data, "data")
fitted_state = {}
feature_columns = _internal_utils.get_column_names(data, self._exclude, self._features)
if not feature_columns:
raise ... | [
"def",
"fit",
"(",
"self",
",",
"data",
")",
":",
"_raise_error_if_not_sframe",
"(",
"data",
",",
"\"data\"",
")",
"fitted_state",
"=",
"{",
"}",
"feature_columns",
"=",
"_internal_utils",
".",
"get_column_names",
"(",
"data",
",",
"self",
".",
"_exclude",
"... | Fits the transformer using the given data. | [
"Fits",
"the",
"transformer",
"using",
"the",
"given",
"data",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L151-L169 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | _ColumnFunctionTransformation.transform | def transform(self, data):
"""
Transforms the data.
"""
if not self._get("fitted"):
raise RuntimeError("`transform` called before `fit` or `fit_transform`.")
data = data.copy()
output_column_prefix = self._get("output_column_prefix")
if output_colum... | python | def transform(self, data):
"""
Transforms the data.
"""
if not self._get("fitted"):
raise RuntimeError("`transform` called before `fit` or `fit_transform`.")
data = data.copy()
output_column_prefix = self._get("output_column_prefix")
if output_colum... | [
"def",
"transform",
"(",
"self",
",",
"data",
")",
":",
"if",
"not",
"self",
".",
"_get",
"(",
"\"fitted\"",
")",
":",
"raise",
"RuntimeError",
"(",
"\"`transform` called before `fit` or `fit_transform`.\"",
")",
"data",
"=",
"data",
".",
"copy",
"(",
")",
"... | Transforms the data. | [
"Transforms",
"the",
"data",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L171-L195 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | _interpretations_class.short_text__str | def short_text__str(self, column_name, output_column_prefix):
"""
Transforms short text into a dictionary of TFIDF-weighted 3-gram
character counts.
"""
from ._ngram_counter import NGramCounter
from ._tfidf import TFIDF
return [NGramCounter(features=[column_name... | python | def short_text__str(self, column_name, output_column_prefix):
"""
Transforms short text into a dictionary of TFIDF-weighted 3-gram
character counts.
"""
from ._ngram_counter import NGramCounter
from ._tfidf import TFIDF
return [NGramCounter(features=[column_name... | [
"def",
"short_text__str",
"(",
"self",
",",
"column_name",
",",
"output_column_prefix",
")",
":",
"from",
".",
"_ngram_counter",
"import",
"NGramCounter",
"from",
".",
"_tfidf",
"import",
"TFIDF",
"return",
"[",
"NGramCounter",
"(",
"features",
"=",
"[",
"column... | Transforms short text into a dictionary of TFIDF-weighted 3-gram
character counts. | [
"Transforms",
"short",
"text",
"into",
"a",
"dictionary",
"of",
"TFIDF",
"-",
"weighted",
"3",
"-",
"gram",
"character",
"counts",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L224-L241 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | _interpretations_class.categorical__int | def categorical__int(self, column_name, output_column_prefix):
"""
Interprets an integer column as a categorical variable.
"""
return [_ColumnFunctionTransformation(
features = [column_name],
output_column_prefix = output_column_prefix,
transform_func... | python | def categorical__int(self, column_name, output_column_prefix):
"""
Interprets an integer column as a categorical variable.
"""
return [_ColumnFunctionTransformation(
features = [column_name],
output_column_prefix = output_column_prefix,
transform_func... | [
"def",
"categorical__int",
"(",
"self",
",",
"column_name",
",",
"output_column_prefix",
")",
":",
"return",
"[",
"_ColumnFunctionTransformation",
"(",
"features",
"=",
"[",
"column_name",
"]",
",",
"output_column_prefix",
"=",
"output_column_prefix",
",",
"transform_... | Interprets an integer column as a categorical variable. | [
"Interprets",
"an",
"integer",
"column",
"as",
"a",
"categorical",
"variable",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L283-L292 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | AutoVectorizer._setup_from_data | def _setup_from_data(self, data):
"""
Sets up the content transforms.
"""
fitted_state = {}
_raise_error_if_not_of_type(data, [_SFrame])
feature_columns = _internal_utils.get_column_names(data, self._exclude, self._features)
if not feature_columns:
... | python | def _setup_from_data(self, data):
"""
Sets up the content transforms.
"""
fitted_state = {}
_raise_error_if_not_of_type(data, [_SFrame])
feature_columns = _internal_utils.get_column_names(data, self._exclude, self._features)
if not feature_columns:
... | [
"def",
"_setup_from_data",
"(",
"self",
",",
"data",
")",
":",
"fitted_state",
"=",
"{",
"}",
"_raise_error_if_not_of_type",
"(",
"data",
",",
"[",
"_SFrame",
"]",
")",
"feature_columns",
"=",
"_internal_utils",
".",
"get_column_names",
"(",
"data",
",",
"self... | Sets up the content transforms. | [
"Sets",
"up",
"the",
"content",
"transforms",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L550-L619 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | AutoVectorizer.fit | def fit(self, data):
"""
Fits a transformer using the SFrame `data`.
Parameters
----------
data : SFrame
The data used to fit the transformer.
Returns
-------
self (A fitted object)
See Also
--------
transform, fit_tr... | python | def fit(self, data):
"""
Fits a transformer using the SFrame `data`.
Parameters
----------
data : SFrame
The data used to fit the transformer.
Returns
-------
self (A fitted object)
See Also
--------
transform, fit_tr... | [
"def",
"fit",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"_setup_from_data",
"(",
"data",
")",
"self",
".",
"transform_chain",
".",
"fit",
"(",
"data",
")",
"self",
".",
"__proxy__",
".",
"update",
"(",
"{",
"\"fitted\"",
":",
"True",
"}",
")",... | Fits a transformer using the SFrame `data`.
Parameters
----------
data : SFrame
The data used to fit the transformer.
Returns
-------
self (A fitted object)
See Also
--------
transform, fit_transform | [
"Fits",
"a",
"transformer",
"using",
"the",
"SFrame",
"data",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L621-L643 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | AutoVectorizer.fit_transform | def fit_transform(self, data):
"""
Fits and transforms the SFrame `data` using a fitted model.
Parameters
----------
data : SFrame
The data to be transformed.
Returns
-------
A transformed SFrame.
Returns
-------
out... | python | def fit_transform(self, data):
"""
Fits and transforms the SFrame `data` using a fitted model.
Parameters
----------
data : SFrame
The data to be transformed.
Returns
-------
A transformed SFrame.
Returns
-------
out... | [
"def",
"fit_transform",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"_setup_from_data",
"(",
"data",
")",
"ret",
"=",
"self",
".",
"transform_chain",
".",
"fit_transform",
"(",
"data",
")",
"self",
".",
"__proxy__",
".",
"update",
"(",
"{",
"\"fitte... | Fits and transforms the SFrame `data` using a fitted model.
Parameters
----------
data : SFrame
The data to be transformed.
Returns
-------
A transformed SFrame.
Returns
-------
out: SFrame
A transformed SFrame.
... | [
"Fits",
"and",
"transforms",
"the",
"SFrame",
"data",
"using",
"a",
"fitted",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L645-L671 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | AutoVectorizer.transform | def transform(self, data):
"""
Transform the SFrame `data` using a fitted model.
Parameters
----------
data : SFrame
The data to be transformed.
Returns
-------
A transformed SFrame.
Returns
-------
out: SFrame
... | python | def transform(self, data):
"""
Transform the SFrame `data` using a fitted model.
Parameters
----------
data : SFrame
The data to be transformed.
Returns
-------
A transformed SFrame.
Returns
-------
out: SFrame
... | [
"def",
"transform",
"(",
"self",
",",
"data",
")",
":",
"if",
"self",
".",
"transform_chain",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"\"`transform()` method called before `fit` or `fit_transform`.\"",
")",
"return",
"self",
".",
"transform_chain",
".",
"tr... | Transform the SFrame `data` using a fitted model.
Parameters
----------
data : SFrame
The data to be transformed.
Returns
-------
A transformed SFrame.
Returns
-------
out: SFrame
A transformed SFrame.
See Also
... | [
"Transform",
"the",
"SFrame",
"data",
"using",
"a",
"fitted",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L673-L699 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | AutoVectorizer._get_summary_struct | def _get_summary_struct(self):
"""
Returns a structured description of the model, including (where relevant)
the schema of the training data, description of the training data,
training statistics, and model hyperparameters.
Returns
-------
sections : list (of lis... | python | def _get_summary_struct(self):
"""
Returns a structured description of the model, including (where relevant)
the schema of the training data, description of the training data,
training statistics, and model hyperparameters.
Returns
-------
sections : list (of lis... | [
"def",
"_get_summary_struct",
"(",
"self",
")",
":",
"sections",
"=",
"[",
"]",
"fields",
"=",
"[",
"]",
"_features",
"=",
"_precomputed_field",
"(",
"_internal_utils",
".",
"pretty_print_list",
"(",
"self",
".",
"features",
")",
")",
"_exclude",
"=",
"_prec... | Returns a structured description of the model, including (where relevant)
the schema of the training data, description of the training data,
training statistics, and model hyperparameters.
Returns
-------
sections : list (of list of tuples)
A list of summary sections... | [
"Returns",
"a",
"structured",
"description",
"of",
"the",
"model",
"including",
"(",
"where",
"relevant",
")",
"the",
"schema",
"of",
"the",
"training",
"data",
"description",
"of",
"the",
"training",
"data",
"training",
"statistics",
"and",
"model",
"hyperparam... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L702-L761 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py | AutoVectorizer._save_impl | def _save_impl(self, pickler):
"""
Save the model as a directory, which can be loaded with the
:py:func:`~turicreate.load_model` method.
Parameters
----------
pickler : GLPickler
An opened GLPickle archive (Do not close the archive).
See Also
... | python | def _save_impl(self, pickler):
"""
Save the model as a directory, which can be loaded with the
:py:func:`~turicreate.load_model` method.
Parameters
----------
pickler : GLPickler
An opened GLPickle archive (Do not close the archive).
See Also
... | [
"def",
"_save_impl",
"(",
"self",
",",
"pickler",
")",
":",
"pickler",
".",
"dump",
"(",
"(",
"self",
".",
"__proxy__",
".",
"state",
",",
"self",
".",
"_exclude",
",",
"self",
".",
"_features",
")",
")"
] | Save the model as a directory, which can be loaded with the
:py:func:`~turicreate.load_model` method.
Parameters
----------
pickler : GLPickler
An opened GLPickle archive (Do not close the archive).
See Also
--------
turicreate.load_model
Ex... | [
"Save",
"the",
"model",
"as",
"a",
"directory",
"which",
"can",
"be",
"loaded",
"with",
"the",
":",
"py",
":",
"func",
":",
"~turicreate",
".",
"load_model",
"method",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L796-L815 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | Mox.CreateMock | def CreateMock(self, class_to_mock):
"""Create a new mock object.
Args:
# class_to_mock: the class to be mocked
class_to_mock: class
Returns:
MockObject that can be used as the class_to_mock would be.
"""
new_mock = MockObject(class_to_mock)
self._mock_objects.append(new_moc... | python | def CreateMock(self, class_to_mock):
"""Create a new mock object.
Args:
# class_to_mock: the class to be mocked
class_to_mock: class
Returns:
MockObject that can be used as the class_to_mock would be.
"""
new_mock = MockObject(class_to_mock)
self._mock_objects.append(new_moc... | [
"def",
"CreateMock",
"(",
"self",
",",
"class_to_mock",
")",
":",
"new_mock",
"=",
"MockObject",
"(",
"class_to_mock",
")",
"self",
".",
"_mock_objects",
".",
"append",
"(",
"new_mock",
")",
"return",
"new_mock"
] | Create a new mock object.
Args:
# class_to_mock: the class to be mocked
class_to_mock: class
Returns:
MockObject that can be used as the class_to_mock would be. | [
"Create",
"a",
"new",
"mock",
"object",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L164-L177 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | Mox.StubOutWithMock | def StubOutWithMock(self, obj, attr_name, use_mock_anything=False):
"""Replace a method, attribute, etc. with a Mock.
This will replace a class or module with a MockObject, and everything else
(method, function, etc) with a MockAnything. This can be overridden to
always use a MockAnything by setting u... | python | def StubOutWithMock(self, obj, attr_name, use_mock_anything=False):
"""Replace a method, attribute, etc. with a Mock.
This will replace a class or module with a MockObject, and everything else
(method, function, etc) with a MockAnything. This can be overridden to
always use a MockAnything by setting u... | [
"def",
"StubOutWithMock",
"(",
"self",
",",
"obj",
",",
"attr_name",
",",
"use_mock_anything",
"=",
"False",
")",
":",
"attr_to_replace",
"=",
"getattr",
"(",
"obj",
",",
"attr_name",
")",
"if",
"type",
"(",
"attr_to_replace",
")",
"in",
"self",
".",
"_USE... | Replace a method, attribute, etc. with a Mock.
This will replace a class or module with a MockObject, and everything else
(method, function, etc) with a MockAnything. This can be overridden to
always use a MockAnything by setting use_mock_anything to True.
Args:
obj: A Python object (class, mod... | [
"Replace",
"a",
"method",
"attribute",
"etc",
".",
"with",
"a",
"Mock",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L208-L228 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | MockAnything._Verify | def _Verify(self):
"""Verify that all of the expected calls have been made.
Raises:
ExpectedMethodCallsError: if there are still more method calls in the
expected queue.
"""
# If the list of expected calls is not empty, raise an exception
if self._expected_calls_queue:
# The la... | python | def _Verify(self):
"""Verify that all of the expected calls have been made.
Raises:
ExpectedMethodCallsError: if there are still more method calls in the
expected queue.
"""
# If the list of expected calls is not empty, raise an exception
if self._expected_calls_queue:
# The la... | [
"def",
"_Verify",
"(",
"self",
")",
":",
"# If the list of expected calls is not empty, raise an exception",
"if",
"self",
".",
"_expected_calls_queue",
":",
"# The last MultipleTimesGroup is not popped from the queue.",
"if",
"(",
"len",
"(",
"self",
".",
"_expected_calls_queu... | Verify that all of the expected calls have been made.
Raises:
ExpectedMethodCallsError: if there are still more method calls in the
expected queue. | [
"Verify",
"that",
"all",
"of",
"the",
"expected",
"calls",
"have",
"been",
"made",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L331-L347 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | MockMethod._VerifyMethodCall | def _VerifyMethodCall(self):
"""Verify the called method is expected.
This can be an ordered method, or part of an unordered set.
Returns:
The expected mock method.
Raises:
UnexpectedMethodCall if the method called was not expected.
"""
expected = self._PopNextMethod()
# Loo... | python | def _VerifyMethodCall(self):
"""Verify the called method is expected.
This can be an ordered method, or part of an unordered set.
Returns:
The expected mock method.
Raises:
UnexpectedMethodCall if the method called was not expected.
"""
expected = self._PopNextMethod()
# Loo... | [
"def",
"_VerifyMethodCall",
"(",
"self",
")",
":",
"expected",
"=",
"self",
".",
"_PopNextMethod",
"(",
")",
"# Loop here, because we might have a MethodGroup followed by another",
"# group.",
"while",
"isinstance",
"(",
"expected",
",",
"MethodGroup",
")",
":",
"expect... | Verify the called method is expected.
This can be an ordered method, or part of an unordered set.
Returns:
The expected mock method.
Raises:
UnexpectedMethodCall if the method called was not expected. | [
"Verify",
"the",
"called",
"method",
"is",
"expected",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L588-L613 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | MockMethod.GetPossibleGroup | def GetPossibleGroup(self):
"""Returns a possible group from the end of the call queue or None if no
other methods are on the stack.
"""
# Remove this method from the tail of the queue so we can add it to a group.
this_method = self._call_queue.pop()
assert this_method == self
# Determine ... | python | def GetPossibleGroup(self):
"""Returns a possible group from the end of the call queue or None if no
other methods are on the stack.
"""
# Remove this method from the tail of the queue so we can add it to a group.
this_method = self._call_queue.pop()
assert this_method == self
# Determine ... | [
"def",
"GetPossibleGroup",
"(",
"self",
")",
":",
"# Remove this method from the tail of the queue so we can add it to a group.",
"this_method",
"=",
"self",
".",
"_call_queue",
".",
"pop",
"(",
")",
"assert",
"this_method",
"==",
"self",
"# Determine if the tail of the queue... | Returns a possible group from the end of the call queue or None if no
other methods are on the stack. | [
"Returns",
"a",
"possible",
"group",
"from",
"the",
"end",
"of",
"the",
"call",
"queue",
"or",
"None",
"if",
"no",
"other",
"methods",
"are",
"on",
"the",
"stack",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L645-L662 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | MockMethod._CheckAndCreateNewGroup | def _CheckAndCreateNewGroup(self, group_name, group_class):
"""Checks if the last method (a possible group) is an instance of our
group_class. Adds the current method to this group or creates a new one.
Args:
group_name: the name of the group.
group_class: the class used to create instance of ... | python | def _CheckAndCreateNewGroup(self, group_name, group_class):
"""Checks if the last method (a possible group) is an instance of our
group_class. Adds the current method to this group or creates a new one.
Args:
group_name: the name of the group.
group_class: the class used to create instance of ... | [
"def",
"_CheckAndCreateNewGroup",
"(",
"self",
",",
"group_name",
",",
"group_class",
")",
":",
"group",
"=",
"self",
".",
"GetPossibleGroup",
"(",
")",
"# If this is a group, and it is the correct group, add the method.",
"if",
"isinstance",
"(",
"group",
",",
"group_c... | Checks if the last method (a possible group) is an instance of our
group_class. Adds the current method to this group or creates a new one.
Args:
group_name: the name of the group.
group_class: the class used to create instance of this new group | [
"Checks",
"if",
"the",
"last",
"method",
"(",
"a",
"possible",
"group",
")",
"is",
"an",
"instance",
"of",
"our",
"group_class",
".",
"Adds",
"the",
"current",
"method",
"to",
"this",
"group",
"or",
"creates",
"a",
"new",
"one",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L664-L684 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | IsA.equals | def equals(self, rhs):
"""Check to see if the RHS is an instance of class_name.
Args:
# rhs: the right hand side of the test
rhs: object
Returns:
bool
"""
try:
return isinstance(rhs, self._class_name)
except TypeError:
# Check raw types if there was a type error.... | python | def equals(self, rhs):
"""Check to see if the RHS is an instance of class_name.
Args:
# rhs: the right hand side of the test
rhs: object
Returns:
bool
"""
try:
return isinstance(rhs, self._class_name)
except TypeError:
# Check raw types if there was a type error.... | [
"def",
"equals",
"(",
"self",
",",
"rhs",
")",
":",
"try",
":",
"return",
"isinstance",
"(",
"rhs",
",",
"self",
".",
"_class_name",
")",
"except",
"TypeError",
":",
"# Check raw types if there was a type error. This is helpful for",
"# things like cStringIO.StringIO."... | Check to see if the RHS is an instance of class_name.
Args:
# rhs: the right hand side of the test
rhs: object
Returns:
bool | [
"Check",
"to",
"see",
"if",
"the",
"RHS",
"is",
"an",
"instance",
"of",
"class_name",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L807-L823 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | IsAlmost.equals | def equals(self, rhs):
"""Check to see if RHS is almost equal to float_value
Args:
rhs: the value to compare to float_value
Returns:
bool
"""
try:
return round(rhs-self._float_value, self._places) == 0
except TypeError:
# This is probably because either float_value or ... | python | def equals(self, rhs):
"""Check to see if RHS is almost equal to float_value
Args:
rhs: the value to compare to float_value
Returns:
bool
"""
try:
return round(rhs-self._float_value, self._places) == 0
except TypeError:
# This is probably because either float_value or ... | [
"def",
"equals",
"(",
"self",
",",
"rhs",
")",
":",
"try",
":",
"return",
"round",
"(",
"rhs",
"-",
"self",
".",
"_float_value",
",",
"self",
".",
"_places",
")",
"==",
"0",
"except",
"TypeError",
":",
"# This is probably because either float_value or rhs is n... | Check to see if RHS is almost equal to float_value
Args:
rhs: the value to compare to float_value
Returns:
bool | [
"Check",
"to",
"see",
"if",
"RHS",
"is",
"almost",
"equal",
"to",
"float_value"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L846-L860 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | ContainsKeyValue.equals | def equals(self, rhs):
"""Check whether the given key/value pair is in the rhs dict.
Returns:
bool
"""
try:
return rhs[self._key] == self._value
except Exception:
return False | python | def equals(self, rhs):
"""Check whether the given key/value pair is in the rhs dict.
Returns:
bool
"""
try:
return rhs[self._key] == self._value
except Exception:
return False | [
"def",
"equals",
"(",
"self",
",",
"rhs",
")",
":",
"try",
":",
"return",
"rhs",
"[",
"self",
".",
"_key",
"]",
"==",
"self",
".",
"_value",
"except",
"Exception",
":",
"return",
"False"
] | Check whether the given key/value pair is in the rhs dict.
Returns:
bool | [
"Check",
"whether",
"the",
"given",
"key",
"/",
"value",
"pair",
"is",
"in",
"the",
"rhs",
"dict",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L989-L999 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | SameElementsAs.equals | def equals(self, actual_seq):
"""Check to see whether actual_seq has same elements as expected_seq.
Args:
actual_seq: sequence
Returns:
bool
"""
try:
expected = dict([(element, None) for element in self._expected_seq])
actual = dict([(element, None) for element in actual_s... | python | def equals(self, actual_seq):
"""Check to see whether actual_seq has same elements as expected_seq.
Args:
actual_seq: sequence
Returns:
bool
"""
try:
expected = dict([(element, None) for element in self._expected_seq])
actual = dict([(element, None) for element in actual_s... | [
"def",
"equals",
"(",
"self",
",",
"actual_seq",
")",
":",
"try",
":",
"expected",
"=",
"dict",
"(",
"[",
"(",
"element",
",",
"None",
")",
"for",
"element",
"in",
"self",
".",
"_expected_seq",
"]",
")",
"actual",
"=",
"dict",
"(",
"[",
"(",
"eleme... | Check to see whether actual_seq has same elements as expected_seq.
Args:
actual_seq: sequence
Returns:
bool | [
"Check",
"to",
"see",
"whether",
"actual_seq",
"has",
"same",
"elements",
"as",
"expected_seq",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L1021-L1040 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | Or.equals | def equals(self, rhs):
"""Checks whether any Comparator is equal to rhs.
Args:
# rhs: can be anything
Returns:
bool
"""
for comparator in self._comparators:
if comparator.equals(rhs):
return True
return False | python | def equals(self, rhs):
"""Checks whether any Comparator is equal to rhs.
Args:
# rhs: can be anything
Returns:
bool
"""
for comparator in self._comparators:
if comparator.equals(rhs):
return True
return False | [
"def",
"equals",
"(",
"self",
",",
"rhs",
")",
":",
"for",
"comparator",
"in",
"self",
".",
"_comparators",
":",
"if",
"comparator",
".",
"equals",
"(",
"rhs",
")",
":",
"return",
"True",
"return",
"False"
] | Checks whether any Comparator is equal to rhs.
Args:
# rhs: can be anything
Returns:
bool | [
"Checks",
"whether",
"any",
"Comparator",
"is",
"equal",
"to",
"rhs",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L1092-L1106 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | UnorderedGroup.MethodCalled | def MethodCalled(self, mock_method):
"""Remove a method call from the group.
If the method is not in the set, an UnexpectedMethodCallError will be
raised.
Args:
mock_method: a mock method that should be equal to a method in the group.
Returns:
The mock method from the group
Raise... | python | def MethodCalled(self, mock_method):
"""Remove a method call from the group.
If the method is not in the set, an UnexpectedMethodCallError will be
raised.
Args:
mock_method: a mock method that should be equal to a method in the group.
Returns:
The mock method from the group
Raise... | [
"def",
"MethodCalled",
"(",
"self",
",",
"mock_method",
")",
":",
"# Check to see if this method exists, and if so, remove it from the set",
"# and return it.",
"for",
"method",
"in",
"self",
".",
"_methods",
":",
"if",
"method",
"==",
"mock_method",
":",
"# Remove the ca... | Remove a method call from the group.
If the method is not in the set, an UnexpectedMethodCallError will be
raised.
Args:
mock_method: a mock method that should be equal to a method in the group.
Returns:
The mock method from the group
Raises:
UnexpectedMethodCallError if the mo... | [
"Remove",
"a",
"method",
"call",
"from",
"the",
"group",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L1223-L1255 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | MultipleTimesGroup.MethodCalled | def MethodCalled(self, mock_method):
"""Remove a method call from the group.
If the method is not in the set, an UnexpectedMethodCallError will be
raised.
Args:
mock_method: a mock method that should be equal to a method in the group.
Returns:
The mock method from the group
Raise... | python | def MethodCalled(self, mock_method):
"""Remove a method call from the group.
If the method is not in the set, an UnexpectedMethodCallError will be
raised.
Args:
mock_method: a mock method that should be equal to a method in the group.
Returns:
The mock method from the group
Raise... | [
"def",
"MethodCalled",
"(",
"self",
",",
"mock_method",
")",
":",
"# Check to see if this method exists, and if so add it to the set of",
"# called methods.",
"for",
"method",
"in",
"self",
".",
"_methods",
":",
"if",
"method",
"==",
"mock_method",
":",
"self",
".",
"... | Remove a method call from the group.
If the method is not in the set, an UnexpectedMethodCallError will be
raised.
Args:
mock_method: a mock method that should be equal to a method in the group.
Returns:
The mock method from the group
Raises:
UnexpectedMethodCallError if the mo... | [
"Remove",
"a",
"method",
"call",
"from",
"the",
"group",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L1285-L1316 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py | MultipleTimesGroup.IsSatisfied | def IsSatisfied(self):
"""Return True if all methods in this group are called at least once."""
# NOTE(psycho): We can't use the simple set difference here because we want
# to match different parameters which are considered the same e.g. IsA(str)
# and some string. This solution is O(n^2) but n should ... | python | def IsSatisfied(self):
"""Return True if all methods in this group are called at least once."""
# NOTE(psycho): We can't use the simple set difference here because we want
# to match different parameters which are considered the same e.g. IsA(str)
# and some string. This solution is O(n^2) but n should ... | [
"def",
"IsSatisfied",
"(",
"self",
")",
":",
"# NOTE(psycho): We can't use the simple set difference here because we want",
"# to match different parameters which are considered the same e.g. IsA(str)",
"# and some string. This solution is O(n^2) but n should be small.",
"tmp",
"=",
"self",
... | Return True if all methods in this group are called at least once. | [
"Return",
"True",
"if",
"all",
"methods",
"in",
"this",
"group",
"are",
"called",
"at",
"least",
"once",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/mox.py#L1318-L1331 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_dict_vectorizer.py | convert | def convert(model, input_features, output_features):
"""Convert a _imputer model to the protobuf spec.
Parameters
----------
model: Imputer
A trained Imputer model.
input_features: str
Name of the input column.
output_features: str
Name of the output column.
Retur... | python | def convert(model, input_features, output_features):
"""Convert a _imputer model to the protobuf spec.
Parameters
----------
model: Imputer
A trained Imputer model.
input_features: str
Name of the input column.
output_features: str
Name of the output column.
Retur... | [
"def",
"convert",
"(",
"model",
",",
"input_features",
",",
"output_features",
")",
":",
"_INTERMEDIATE_FEATURE_NAME",
"=",
"\"__sparse_vector_features__\"",
"n_dimensions",
"=",
"len",
"(",
"model",
".",
"feature_names_",
")",
"input_features",
"=",
"process_or_validat... | Convert a _imputer model to the protobuf spec.
Parameters
----------
model: Imputer
A trained Imputer model.
input_features: str
Name of the input column.
output_features: str
Name of the output column.
Returns
-------
model_spec: An object of type Model_pb.
... | [
"Convert",
"a",
"_imputer",
"model",
"to",
"the",
"protobuf",
"spec",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_dict_vectorizer.py#L29-L102 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/_interface_management.py | set_classifier_interface_params | def set_classifier_interface_params(spec, features, class_labels,
model_accessor_for_class_labels, output_features = None):
"""
Common utilities to set the regression interface params.
"""
# Normalize the features list.
features = _fm.process_or_validate_features(features)
if class_labe... | python | def set_classifier_interface_params(spec, features, class_labels,
model_accessor_for_class_labels, output_features = None):
"""
Common utilities to set the regression interface params.
"""
# Normalize the features list.
features = _fm.process_or_validate_features(features)
if class_labe... | [
"def",
"set_classifier_interface_params",
"(",
"spec",
",",
"features",
",",
"class_labels",
",",
"model_accessor_for_class_labels",
",",
"output_features",
"=",
"None",
")",
":",
"# Normalize the features list.",
"features",
"=",
"_fm",
".",
"process_or_validate_features",... | Common utilities to set the regression interface params. | [
"Common",
"utilities",
"to",
"set",
"the",
"regression",
"interface",
"params",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/_interface_management.py#L13-L100 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/_interface_management.py | set_regressor_interface_params | def set_regressor_interface_params(spec, features, output_features):
""" Common utilities to set the regressor interface params.
"""
if output_features is None:
output_features = [("predicted_class", datatypes.Double())]
else:
output_features = _fm.process_or_validate_features(output_fea... | python | def set_regressor_interface_params(spec, features, output_features):
""" Common utilities to set the regressor interface params.
"""
if output_features is None:
output_features = [("predicted_class", datatypes.Double())]
else:
output_features = _fm.process_or_validate_features(output_fea... | [
"def",
"set_regressor_interface_params",
"(",
"spec",
",",
"features",
",",
"output_features",
")",
":",
"if",
"output_features",
"is",
"None",
":",
"output_features",
"=",
"[",
"(",
"\"predicted_class\"",
",",
"datatypes",
".",
"Double",
"(",
")",
")",
"]",
"... | Common utilities to set the regressor interface params. | [
"Common",
"utilities",
"to",
"set",
"the",
"regressor",
"interface",
"params",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/_interface_management.py#L102-L132 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/_interface_management.py | set_transform_interface_params | def set_transform_interface_params(spec, input_features, output_features, are_optional = False):
""" Common utilities to set transform interface params.
"""
input_features = _fm.process_or_validate_features(input_features)
output_features = _fm.process_or_validate_features(output_features)
# Add in... | python | def set_transform_interface_params(spec, input_features, output_features, are_optional = False):
""" Common utilities to set transform interface params.
"""
input_features = _fm.process_or_validate_features(input_features)
output_features = _fm.process_or_validate_features(output_features)
# Add in... | [
"def",
"set_transform_interface_params",
"(",
"spec",
",",
"input_features",
",",
"output_features",
",",
"are_optional",
"=",
"False",
")",
":",
"input_features",
"=",
"_fm",
".",
"process_or_validate_features",
"(",
"input_features",
")",
"output_features",
"=",
"_f... | Common utilities to set transform interface params. | [
"Common",
"utilities",
"to",
"set",
"transform",
"interface",
"params",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/_interface_management.py#L134-L153 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/activity_classifier/_sframe_sequence_iterator.py | prep_data | def prep_data(data, features, session_id, prediction_window, predictions_in_chunk, target=None, verbose=True):
"""
Convert SFrame to batch form, where each row contains a sequence of length
predictions_in_chunk * prediction_window, and there is a single label per
prediction window.
"""
if target... | python | def prep_data(data, features, session_id, prediction_window, predictions_in_chunk, target=None, verbose=True):
"""
Convert SFrame to batch form, where each row contains a sequence of length
predictions_in_chunk * prediction_window, and there is a single label per
prediction window.
"""
if target... | [
"def",
"prep_data",
"(",
"data",
",",
"features",
",",
"session_id",
",",
"prediction_window",
",",
"predictions_in_chunk",
",",
"target",
"=",
"None",
",",
"verbose",
"=",
"True",
")",
":",
"if",
"target",
"is",
"None",
":",
"target",
"=",
"\"\"",
"if",
... | Convert SFrame to batch form, where each row contains a sequence of length
predictions_in_chunk * prediction_window, and there is a single label per
prediction window. | [
"Convert",
"SFrame",
"to",
"batch",
"form",
"where",
"each",
"row",
"contains",
"a",
"sequence",
"of",
"length",
"predictions_in_chunk",
"*",
"prediction_window",
"and",
"there",
"is",
"a",
"single",
"label",
"per",
"prediction",
"window",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/activity_classifier/_sframe_sequence_iterator.py#L26-L42 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/activity_classifier/_sframe_sequence_iterator.py | _load_into_numpy | def _load_into_numpy(sf, np_array, start, end, strides=None, shape=None):
"""Loads into numpy array from SFrame, assuming SFrame stores data flattened"""
np_array[:] = 0.0
np_array_2d = np_array.reshape((np_array.shape[0], np_array.shape[1] * np_array.shape[2]))
_extensions.sframe_load_to_numpy(sf, np_a... | python | def _load_into_numpy(sf, np_array, start, end, strides=None, shape=None):
"""Loads into numpy array from SFrame, assuming SFrame stores data flattened"""
np_array[:] = 0.0
np_array_2d = np_array.reshape((np_array.shape[0], np_array.shape[1] * np_array.shape[2]))
_extensions.sframe_load_to_numpy(sf, np_a... | [
"def",
"_load_into_numpy",
"(",
"sf",
",",
"np_array",
",",
"start",
",",
"end",
",",
"strides",
"=",
"None",
",",
"shape",
"=",
"None",
")",
":",
"np_array",
"[",
":",
"]",
"=",
"0.0",
"np_array_2d",
"=",
"np_array",
".",
"reshape",
"(",
"(",
"np_ar... | Loads into numpy array from SFrame, assuming SFrame stores data flattened | [
"Loads",
"into",
"numpy",
"array",
"from",
"SFrame",
"assuming",
"SFrame",
"stores",
"data",
"flattened"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/activity_classifier/_sframe_sequence_iterator.py#L49-L55 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.set_input | def set_input(self, input_names, input_dims):
"""
Set the inputs of the network spec.
Parameters
----------
input_names: [str]
List of input names of the network.
input_dims: [tuple]
List of input dimensions of the network. The ordering of input_... | python | def set_input(self, input_names, input_dims):
"""
Set the inputs of the network spec.
Parameters
----------
input_names: [str]
List of input names of the network.
input_dims: [tuple]
List of input dimensions of the network. The ordering of input_... | [
"def",
"set_input",
"(",
"self",
",",
"input_names",
",",
"input_dims",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"for",
"idx",
",",
"dim",
"in",
"enumerate",
"(",
"input_dims",
")",
":",
"if",
"len",
"(",
"d... | Set the inputs of the network spec.
Parameters
----------
input_names: [str]
List of input names of the network.
input_dims: [tuple]
List of input dimensions of the network. The ordering of input_dims
is the same as input_names.
Examples
... | [
"Set",
"the",
"inputs",
"of",
"the",
"network",
"spec",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L159-L202 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.set_output | def set_output(self, output_names, output_dims):
"""
Set the outputs of the network spec.
Parameters
----------
output_names: [str]
List of output names of the network.
output_dims: [tuple]
List of output dimensions of the network. The ordering o... | python | def set_output(self, output_names, output_dims):
"""
Set the outputs of the network spec.
Parameters
----------
output_names: [str]
List of output names of the network.
output_dims: [tuple]
List of output dimensions of the network. The ordering o... | [
"def",
"set_output",
"(",
"self",
",",
"output_names",
",",
"output_dims",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"for",
"idx",
",",
"dim",
"in",
"enumerate",
"(",
"output_dims",
")",
":",
"spec",
".",
"desc... | Set the outputs of the network spec.
Parameters
----------
output_names: [str]
List of output names of the network.
output_dims: [tuple]
List of output dimensions of the network. The ordering of output_dims is the same
as output_names.
Examp... | [
"Set",
"the",
"outputs",
"of",
"the",
"network",
"spec",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L204-L235 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.set_class_labels | def set_class_labels(self, class_labels, predicted_feature_name = 'classLabel', prediction_blob = ''):
"""
Set class labels to the model spec to make it a neural network classifier.
Parameters
----------
class_labels: list[int or str]
A list of integers or strings th... | python | def set_class_labels(self, class_labels, predicted_feature_name = 'classLabel', prediction_blob = ''):
"""
Set class labels to the model spec to make it a neural network classifier.
Parameters
----------
class_labels: list[int or str]
A list of integers or strings th... | [
"def",
"set_class_labels",
"(",
"self",
",",
"class_labels",
",",
"predicted_feature_name",
"=",
"'classLabel'",
",",
"prediction_blob",
"=",
"''",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"if",
"len",
"(",
"spec",
... | Set class labels to the model spec to make it a neural network classifier.
Parameters
----------
class_labels: list[int or str]
A list of integers or strings that map the index of the output of a
neural network to labels in a classifier.
predicted_feature_name: ... | [
"Set",
"class",
"labels",
"to",
"the",
"model",
"spec",
"to",
"make",
"it",
"a",
"neural",
"network",
"classifier",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L237-L299 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_optionals | def add_optionals(self, optionals_in, optionals_out):
"""
Add optional inputs and outputs to the model spec.
Parameters
----------
optionals_in: [str]
List of inputs that are optionals.
optionals_out: [str]
List of outputs that are optionals.
... | python | def add_optionals(self, optionals_in, optionals_out):
"""
Add optional inputs and outputs to the model spec.
Parameters
----------
optionals_in: [str]
List of inputs that are optionals.
optionals_out: [str]
List of outputs that are optionals.
... | [
"def",
"add_optionals",
"(",
"self",
",",
"optionals_in",
",",
"optionals_out",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"if",
"(",
"not",
"optionals_in",
")",
"and",
"(",
"not",
"optionals_out",
")",
":",
"return",
"# assuming single sizes here",
"input_ty... | Add optional inputs and outputs to the model spec.
Parameters
----------
optionals_in: [str]
List of inputs that are optionals.
optionals_out: [str]
List of outputs that are optionals.
See Also
--------
set_input, set_output | [
"Add",
"optional",
"inputs",
"and",
"outputs",
"to",
"the",
"model",
"spec",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L302-L343 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_embedding | def add_embedding(self, name, W, b, input_dim, output_channels, has_bias,
input_name, output_name):
"""
Add an embedding layer to the model.
Parameters
----------
name: str
The name of this layer
W: numpy.array
Weight matrix ... | python | def add_embedding(self, name, W, b, input_dim, output_channels, has_bias,
input_name, output_name):
"""
Add an embedding layer to the model.
Parameters
----------
name: str
The name of this layer
W: numpy.array
Weight matrix ... | [
"def",
"add_embedding",
"(",
"self",
",",
"name",
",",
"W",
",",
"b",
",",
"input_dim",
",",
"output_channels",
",",
"has_bias",
",",
"input_name",
",",
"output_name",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
... | Add an embedding layer to the model.
Parameters
----------
name: str
The name of this layer
W: numpy.array
Weight matrix of shape (output_channels, input_dim).
b: numpy.array
Bias vector of shape (output_channels, ).
input_dim: int
... | [
"Add",
"an",
"embedding",
"layer",
"to",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L400-L453 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_softmax | def add_softmax(self, name, input_name, output_name):
"""
Add a softmax layer to the model.
Parameters
----------
name: str
The name of this layer.
input_name: str
The input blob name of this layer.
output_name: str
The output ... | python | def add_softmax(self, name, input_name, output_name):
"""
Add a softmax layer to the model.
Parameters
----------
name: str
The name of this layer.
input_name: str
The input blob name of this layer.
output_name: str
The output ... | [
"def",
"add_softmax",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",
"=",
"nn_spec",
".",
"layers",
".",
"add",
"(",
... | Add a softmax layer to the model.
Parameters
----------
name: str
The name of this layer.
input_name: str
The input blob name of this layer.
output_name: str
The output blob name of this layer.
See Also
--------
add_ac... | [
"Add",
"a",
"softmax",
"layer",
"to",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L456-L482 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_activation | def add_activation(self, name, non_linearity, input_name, output_name,
params=None):
"""
Add an activation layer to the model.
Parameters
----------
name: str
The name of this layer
non_linearity: str
The non_linearity (activation) functio... | python | def add_activation(self, name, non_linearity, input_name, output_name,
params=None):
"""
Add an activation layer to the model.
Parameters
----------
name: str
The name of this layer
non_linearity: str
The non_linearity (activation) functio... | [
"def",
"add_activation",
"(",
"self",
",",
"name",
",",
"non_linearity",
",",
"input_name",
",",
"output_name",
",",
"params",
"=",
"None",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",... | Add an activation layer to the model.
Parameters
----------
name: str
The name of this layer
non_linearity: str
The non_linearity (activation) function of this layer.
It can be one of the following:
- 'RELU': Rectified Linear Unit (Re... | [
"Add",
"an",
"activation",
"layer",
"to",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L484-L648 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_elementwise | def add_elementwise(self, name, input_names, output_name, mode, alpha = None):
"""
Add an element-wise operation layer to the model.
Parameters
----------
The name of this layer
name: str
input_names: [str]
A list of input blob names of this layer... | python | def add_elementwise(self, name, input_names, output_name, mode, alpha = None):
"""
Add an element-wise operation layer to the model.
Parameters
----------
The name of this layer
name: str
input_names: [str]
A list of input blob names of this layer... | [
"def",
"add_elementwise",
"(",
"self",
",",
"name",
",",
"input_names",
",",
"output_name",
",",
"mode",
",",
"alpha",
"=",
"None",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"spec_layer",
"=",
"nn_spec",
".",
"... | Add an element-wise operation layer to the model.
Parameters
----------
The name of this layer
name: str
input_names: [str]
A list of input blob names of this layer. The input blobs should have the same shape.
output_name: str
The output blob ... | [
"Add",
"an",
"element",
"-",
"wise",
"operation",
"layer",
"to",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L650-L721 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_upsample | def add_upsample(self, name, scaling_factor_h, scaling_factor_w, input_name, output_name, mode = 'NN'):
"""
Add upsample layer to the model.
Parameters
----------
name: str
The name of this layer.
scaling_factor_h: int
Scaling factor on the vertic... | python | def add_upsample(self, name, scaling_factor_h, scaling_factor_w, input_name, output_name, mode = 'NN'):
"""
Add upsample layer to the model.
Parameters
----------
name: str
The name of this layer.
scaling_factor_h: int
Scaling factor on the vertic... | [
"def",
"add_upsample",
"(",
"self",
",",
"name",
",",
"scaling_factor_h",
",",
"scaling_factor_w",
",",
"input_name",
",",
"output_name",
",",
"mode",
"=",
"'NN'",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a... | Add upsample layer to the model.
Parameters
----------
name: str
The name of this layer.
scaling_factor_h: int
Scaling factor on the vertical direction.
scaling_factor_w: int
Scaling factor on the horizontal direction.
input_name: str
... | [
"Add",
"upsample",
"layer",
"to",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L723-L764 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_scale | def add_scale(self, name, W, b, has_bias, input_name, output_name, shape_scale = [1], shape_bias = [1]):
"""
Add scale layer to the model.
Parameters
----------
name: str
The name of this layer.
W: int | numpy.array
Scale of the input.
b: ... | python | def add_scale(self, name, W, b, has_bias, input_name, output_name, shape_scale = [1], shape_bias = [1]):
"""
Add scale layer to the model.
Parameters
----------
name: str
The name of this layer.
W: int | numpy.array
Scale of the input.
b: ... | [
"def",
"add_scale",
"(",
"self",
",",
"name",
",",
"W",
",",
"b",
",",
"has_bias",
",",
"input_name",
",",
"output_name",
",",
"shape_scale",
"=",
"[",
"1",
"]",
",",
"shape_bias",
"=",
"[",
"1",
"]",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"... | Add scale layer to the model.
Parameters
----------
name: str
The name of this layer.
W: int | numpy.array
Scale of the input.
b: int | numpy.array
Bias to add to the input.
has_bias: boolean
Whether the bias vector of this... | [
"Add",
"scale",
"layer",
"to",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L766-L824 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_bias | def add_bias(self, name, b, input_name, output_name, shape_bias = [1]):
"""
Add bias layer to the model.
Parameters
----------
name: str
The name of this layer.
b: int | numpy.array
Bias to add to the input.
input_name: str
The... | python | def add_bias(self, name, b, input_name, output_name, shape_bias = [1]):
"""
Add bias layer to the model.
Parameters
----------
name: str
The name of this layer.
b: int | numpy.array
Bias to add to the input.
input_name: str
The... | [
"def",
"add_bias",
"(",
"self",
",",
"name",
",",
"b",
",",
"input_name",
",",
"output_name",
",",
"shape_bias",
"=",
"[",
"1",
"]",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"spec_layer",
"=",
"nn_spec",
"."... | Add bias layer to the model.
Parameters
----------
name: str
The name of this layer.
b: int | numpy.array
Bias to add to the input.
input_name: str
The input blob name of this layer.
output_name: str
The output blob name of... | [
"Add",
"bias",
"layer",
"to",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L826-L864 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_sequence_repeat | def add_sequence_repeat(self, name, nrep, input_name, output_name):
"""
Add sequence repeat layer to the model.
Parameters
----------
name: str
The name of this layer.
nrep: int
Number of repetitions of the input blob along the sequence axis.
... | python | def add_sequence_repeat(self, name, nrep, input_name, output_name):
"""
Add sequence repeat layer to the model.
Parameters
----------
name: str
The name of this layer.
nrep: int
Number of repetitions of the input blob along the sequence axis.
... | [
"def",
"add_sequence_repeat",
"(",
"self",
",",
"name",
",",
"nrep",
",",
"input_name",
",",
"output_name",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"spec_layer",
"=",
"nn_spec",
".",
"layers",
".",
"add",
"(",
... | Add sequence repeat layer to the model.
Parameters
----------
name: str
The name of this layer.
nrep: int
Number of repetitions of the input blob along the sequence axis.
input_name: str
The input blob name of this layer.
output_name: ... | [
"Add",
"sequence",
"repeat",
"layer",
"to",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L866-L892 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_convolution | def add_convolution(self, name, kernel_channels, output_channels, height,
width, stride_height, stride_width, border_mode, groups, W, b, has_bias,
is_deconv = False, output_shape = None,
input_name = 'data', output_name = 'out',
dilation_factors = [1,1],
paddi... | python | def add_convolution(self, name, kernel_channels, output_channels, height,
width, stride_height, stride_width, border_mode, groups, W, b, has_bias,
is_deconv = False, output_shape = None,
input_name = 'data', output_name = 'out',
dilation_factors = [1,1],
paddi... | [
"def",
"add_convolution",
"(",
"self",
",",
"name",
",",
"kernel_channels",
",",
"output_channels",
",",
"height",
",",
"width",
",",
"stride_height",
",",
"stride_width",
",",
"border_mode",
",",
"groups",
",",
"W",
",",
"b",
",",
"has_bias",
",",
"is_decon... | Add a convolution layer to the network.
Please see the ConvolutionLayerParams in Core ML neural network
protobuf message for more information about input and output blob dimensions.
Parameters
----------
name: str
The name of this layer.
kernel_channels: int... | [
"Add",
"a",
"convolution",
"layer",
"to",
"the",
"network",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L894-L1049 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_padding | def add_padding(self, name,
left = 0, right = 0, top = 0, bottom = 0,
value = 0,
input_name = 'data', output_name = 'out',
padding_type = 'constant'):
"""
Add a padding layer to the model. Kindly refer to NeuralNetwork.proto for details.
Parameter... | python | def add_padding(self, name,
left = 0, right = 0, top = 0, bottom = 0,
value = 0,
input_name = 'data', output_name = 'out',
padding_type = 'constant'):
"""
Add a padding layer to the model. Kindly refer to NeuralNetwork.proto for details.
Parameter... | [
"def",
"add_padding",
"(",
"self",
",",
"name",
",",
"left",
"=",
"0",
",",
"right",
"=",
"0",
",",
"top",
"=",
"0",
",",
"bottom",
"=",
"0",
",",
"value",
"=",
"0",
",",
"input_name",
"=",
"'data'",
",",
"output_name",
"=",
"'out'",
",",
"paddin... | Add a padding layer to the model. Kindly refer to NeuralNetwork.proto for details.
Parameters
----------
name: str
The name of this layer.
left: int
Number of elements to be padded on the left side of the input blob.
right: int
Number of eleme... | [
"Add",
"a",
"padding",
"layer",
"to",
"the",
"model",
".",
"Kindly",
"refer",
"to",
"NeuralNetwork",
".",
"proto",
"for",
"details",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1148-L1208 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_crop | def add_crop(self, name, left, right, top, bottom, offset, input_names,
output_name):
"""
Add a cropping layer to the model.
The cropping layer have two functional modes:
- When it has 1 input blob, it crops the input blob based
on the 4 parameters [left, r... | python | def add_crop(self, name, left, right, top, bottom, offset, input_names,
output_name):
"""
Add a cropping layer to the model.
The cropping layer have two functional modes:
- When it has 1 input blob, it crops the input blob based
on the 4 parameters [left, r... | [
"def",
"add_crop",
"(",
"self",
",",
"name",
",",
"left",
",",
"right",
",",
"top",
",",
"bottom",
",",
"offset",
",",
"input_names",
",",
"output_name",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new l... | Add a cropping layer to the model.
The cropping layer have two functional modes:
- When it has 1 input blob, it crops the input blob based
on the 4 parameters [left, right, top, bottom].
- When it has 2 input blobs, it crops the first input blob based
on the ... | [
"Add",
"a",
"cropping",
"layer",
"to",
"the",
"model",
".",
"The",
"cropping",
"layer",
"have",
"two",
"functional",
"modes",
":"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1210-L1269 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_simple_rnn | def add_simple_rnn(self,name, W_h, W_x, b, hidden_size, input_size, activation, input_names, output_names, output_all = False, reverse_input = False):
"""
Add a simple recurrent layer to the model.
Parameters
----------
name: str
The name of this layer.
W_h: ... | python | def add_simple_rnn(self,name, W_h, W_x, b, hidden_size, input_size, activation, input_names, output_names, output_all = False, reverse_input = False):
"""
Add a simple recurrent layer to the model.
Parameters
----------
name: str
The name of this layer.
W_h: ... | [
"def",
"add_simple_rnn",
"(",
"self",
",",
"name",
",",
"W_h",
",",
"W_x",
",",
"b",
",",
"hidden_size",
",",
"input_size",
",",
"activation",
",",
"input_names",
",",
"output_names",
",",
"output_all",
"=",
"False",
",",
"reverse_input",
"=",
"False",
")"... | Add a simple recurrent layer to the model.
Parameters
----------
name: str
The name of this layer.
W_h: numpy.array
Weights of the recurrent layer's hidden state. Must be of shape (hidden_size, hidden_size).
W_x: numpy.array
Weights of the rec... | [
"Add",
"a",
"simple",
"recurrent",
"layer",
"to",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1271-L1341 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_gru | def add_gru(self, name, W_h, W_x, b, hidden_size, input_size,
input_names, output_names, activation = 'TANH', inner_activation = 'SIGMOID_HARD',
output_all = False, reverse_input = False):
"""
Add a Gated-Recurrent Unit (GRU) layer to the model.
Parameters
------... | python | def add_gru(self, name, W_h, W_x, b, hidden_size, input_size,
input_names, output_names, activation = 'TANH', inner_activation = 'SIGMOID_HARD',
output_all = False, reverse_input = False):
"""
Add a Gated-Recurrent Unit (GRU) layer to the model.
Parameters
------... | [
"def",
"add_gru",
"(",
"self",
",",
"name",
",",
"W_h",
",",
"W_x",
",",
"b",
",",
"hidden_size",
",",
"input_size",
",",
"input_names",
",",
"output_names",
",",
"activation",
"=",
"'TANH'",
",",
"inner_activation",
"=",
"'SIGMOID_HARD'",
",",
"output_all",... | Add a Gated-Recurrent Unit (GRU) layer to the model.
Parameters
----------
name: str
The name of this layer.
W_h: [numpy.array]
List of recursion weight matrices. The ordering is [R_z, R_r, R_o],
where R_z, R_r and R_o are weight matrices at update ga... | [
"Add",
"a",
"Gated",
"-",
"Recurrent",
"Unit",
"(",
"GRU",
")",
"layer",
"to",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1343-L1440 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_unilstm | def add_unilstm(self, name, W_h, W_x, b, hidden_size, input_size, input_names, output_names,
inner_activation = 'SIGMOID',
cell_state_update_activation = 'TANH',
output_activation = 'TANH',
peep = None,
output_all = Fals... | python | def add_unilstm(self, name, W_h, W_x, b, hidden_size, input_size, input_names, output_names,
inner_activation = 'SIGMOID',
cell_state_update_activation = 'TANH',
output_activation = 'TANH',
peep = None,
output_all = Fals... | [
"def",
"add_unilstm",
"(",
"self",
",",
"name",
",",
"W_h",
",",
"W_x",
",",
"b",
",",
"hidden_size",
",",
"input_size",
",",
"input_names",
",",
"output_names",
",",
"inner_activation",
"=",
"'SIGMOID'",
",",
"cell_state_update_activation",
"=",
"'TANH'",
","... | Add a Uni-directional LSTM layer to the model.
Parameters
----------
name: str
The name of this layer.
W_h: [numpy.array]
List of recursion weight matrices. The ordering is [R_i, R_f, R_o, R_z],
where R_i, R_f, R_o, R_z are weight matrices at input ga... | [
"Add",
"a",
"Uni",
"-",
"directional",
"LSTM",
"layer",
"to",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1442-L1574 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_bidirlstm | def add_bidirlstm(self, name, W_h, W_x, b, W_h_back, W_x_back, b_back, hidden_size, input_size,
input_names, output_names,
inner_activation = 'SIGMOID',
cell_state_update_activation = 'TANH',
output_activation = 'TANH',
peep = None, peep_back = None,
... | python | def add_bidirlstm(self, name, W_h, W_x, b, W_h_back, W_x_back, b_back, hidden_size, input_size,
input_names, output_names,
inner_activation = 'SIGMOID',
cell_state_update_activation = 'TANH',
output_activation = 'TANH',
peep = None, peep_back = None,
... | [
"def",
"add_bidirlstm",
"(",
"self",
",",
"name",
",",
"W_h",
",",
"W_x",
",",
"b",
",",
"W_h_back",
",",
"W_x_back",
",",
"b_back",
",",
"hidden_size",
",",
"input_size",
",",
"input_names",
",",
"output_names",
",",
"inner_activation",
"=",
"'SIGMOID'",
... | Add a Bi-directional LSTM layer to the model.
Parameters
----------
name: str
The name of this layer.
W_h: [numpy.array]
List of recursion weight matrices for the forward layer. The ordering is [R_i, R_f, R_o, R_z],
where R_i, R_f, R_o, R_z are weight... | [
"Add",
"a",
"Bi",
"-",
"directional",
"LSTM",
"layer",
"to",
"the",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1576-L1759 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_flatten | def add_flatten(self, name, mode, input_name, output_name):
"""
Add a flatten layer. Only flattens the channel, height and width axis. Leaves the sequence axis as is.
Parameters
----------
name: str
The name of this layer.
mode: int
- If mode == ... | python | def add_flatten(self, name, mode, input_name, output_name):
"""
Add a flatten layer. Only flattens the channel, height and width axis. Leaves the sequence axis as is.
Parameters
----------
name: str
The name of this layer.
mode: int
- If mode == ... | [
"def",
"add_flatten",
"(",
"self",
",",
"name",
",",
"mode",
",",
"input_name",
",",
"output_name",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",
"=",
"nn_spec",
".",
"layers",
".",
... | Add a flatten layer. Only flattens the channel, height and width axis. Leaves the sequence axis as is.
Parameters
----------
name: str
The name of this layer.
mode: int
- If mode == 0, the flatten layer is in CHANNEL_FIRST mode.
- If mode == 1, the f... | [
"Add",
"a",
"flatten",
"layer",
".",
"Only",
"flattens",
"the",
"channel",
"height",
"and",
"width",
"axis",
".",
"Leaves",
"the",
"sequence",
"axis",
"as",
"is",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1761-L1802 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_slice | def add_slice(self, name, input_name, output_name, axis, start_index = 0, end_index = -1, stride = 1):
"""
Add a slice layer. Equivalent to to numpy slice [start_index:end_index:stride],
start_index is included, while end_index is exclusive.
Parameters
----------
name: s... | python | def add_slice(self, name, input_name, output_name, axis, start_index = 0, end_index = -1, stride = 1):
"""
Add a slice layer. Equivalent to to numpy slice [start_index:end_index:stride],
start_index is included, while end_index is exclusive.
Parameters
----------
name: s... | [
"def",
"add_slice",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
",",
"axis",
",",
"start_index",
"=",
"0",
",",
"end_index",
"=",
"-",
"1",
",",
"stride",
"=",
"1",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"s... | Add a slice layer. Equivalent to to numpy slice [start_index:end_index:stride],
start_index is included, while end_index is exclusive.
Parameters
----------
name: str
The name of this layer.
input_name: str
The input blob name of this layer.
outp... | [
"Add",
"a",
"slice",
"layer",
".",
"Equivalent",
"to",
"to",
"numpy",
"slice",
"[",
"start_index",
":",
"end_index",
":",
"stride",
"]",
"start_index",
"is",
"included",
"while",
"end_index",
"is",
"exclusive",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1804-L1864 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_reorganize_data | def add_reorganize_data(self, name, input_name, output_name, mode = 'SPACE_TO_DEPTH', block_size = 2):
"""
Add a data reorganization layer of type "SPACE_TO_DEPTH" or "DEPTH_TO_SPACE".
Parameters
----------
name: str
The name of this layer.
input_name: str
... | python | def add_reorganize_data(self, name, input_name, output_name, mode = 'SPACE_TO_DEPTH', block_size = 2):
"""
Add a data reorganization layer of type "SPACE_TO_DEPTH" or "DEPTH_TO_SPACE".
Parameters
----------
name: str
The name of this layer.
input_name: str
... | [
"def",
"add_reorganize_data",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
",",
"mode",
"=",
"'SPACE_TO_DEPTH'",
",",
"block_size",
"=",
"2",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a n... | Add a data reorganization layer of type "SPACE_TO_DEPTH" or "DEPTH_TO_SPACE".
Parameters
----------
name: str
The name of this layer.
input_name: str
The input blob name of this layer.
output_name: str
The output blob name of this layer.
... | [
"Add",
"a",
"data",
"reorganization",
"layer",
"of",
"type",
"SPACE_TO_DEPTH",
"or",
"DEPTH_TO_SPACE",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1867-L1922 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_batchnorm | def add_batchnorm(self, name, channels, gamma, beta,
mean = None, variance = None,
input_name = 'data', output_name = 'out',
compute_mean_var = False,
instance_normalization = False, epsilon = 1e-5):
"""
Add a Batch ... | python | def add_batchnorm(self, name, channels, gamma, beta,
mean = None, variance = None,
input_name = 'data', output_name = 'out',
compute_mean_var = False,
instance_normalization = False, epsilon = 1e-5):
"""
Add a Batch ... | [
"def",
"add_batchnorm",
"(",
"self",
",",
"name",
",",
"channels",
",",
"gamma",
",",
"beta",
",",
"mean",
"=",
"None",
",",
"variance",
"=",
"None",
",",
"input_name",
"=",
"'data'",
",",
"output_name",
"=",
"'out'",
",",
"compute_mean_var",
"=",
"False... | Add a Batch Normalization layer. Batch Normalization operation is
defined as:
`y = gamma * (x - mean) / sqrt(variance + epsilon) + beta`
Parameters
----------
name: str
The name of this layer.
channels: int
Number of channels of the input blob.
... | [
"Add",
"a",
"Batch",
"Normalization",
"layer",
".",
"Batch",
"Normalization",
"operation",
"is",
"defined",
"as",
":"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1924-L1991 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_permute | def add_permute(self, name, dim, input_name, output_name):
"""
Add a permute layer. Assumes that the input has dimensions in the order [Seq, C, H, W]
Parameters
----------
name: str
The name of this layer.
dim: tuple
The order in which to permute ... | python | def add_permute(self, name, dim, input_name, output_name):
"""
Add a permute layer. Assumes that the input has dimensions in the order [Seq, C, H, W]
Parameters
----------
name: str
The name of this layer.
dim: tuple
The order in which to permute ... | [
"def",
"add_permute",
"(",
"self",
",",
"name",
",",
"dim",
",",
"input_name",
",",
"output_name",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",
"=",
"nn_spec",
".",
"layers",
".",
... | Add a permute layer. Assumes that the input has dimensions in the order [Seq, C, H, W]
Parameters
----------
name: str
The name of this layer.
dim: tuple
The order in which to permute the input dimensions = [seq,C,H,W].
Must have length 4 and a permut... | [
"Add",
"a",
"permute",
"layer",
".",
"Assumes",
"that",
"the",
"input",
"has",
"dimensions",
"in",
"the",
"order",
"[",
"Seq",
"C",
"H",
"W",
"]"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L1994-L2046 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_reshape | def add_reshape(self, name, input_name, output_name, target_shape, mode):
"""
Add a reshape layer. Kindly refer to NeuralNetwork.proto for details.
Parameters
----------
name: str
The name of this layer.
target_shape: tuple
Shape of the output blo... | python | def add_reshape(self, name, input_name, output_name, target_shape, mode):
"""
Add a reshape layer. Kindly refer to NeuralNetwork.proto for details.
Parameters
----------
name: str
The name of this layer.
target_shape: tuple
Shape of the output blo... | [
"def",
"add_reshape",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
",",
"target_shape",
",",
"mode",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",
"=",
"nn_spec",
... | Add a reshape layer. Kindly refer to NeuralNetwork.proto for details.
Parameters
----------
name: str
The name of this layer.
target_shape: tuple
Shape of the output blob. The product of target_shape must be equal
to the shape of the input blob.
... | [
"Add",
"a",
"reshape",
"layer",
".",
"Kindly",
"refer",
"to",
"NeuralNetwork",
".",
"proto",
"for",
"details",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2048-L2094 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_reduce | def add_reduce(self, name, input_name, output_name, axis, mode, epsilon = 1e-6):
"""
Add a reduce layer. Applies the function specified by the parameter mode,
along dimension(s) specified by the parameter axis.
Parameters
----------
name: str
The name of this... | python | def add_reduce(self, name, input_name, output_name, axis, mode, epsilon = 1e-6):
"""
Add a reduce layer. Applies the function specified by the parameter mode,
along dimension(s) specified by the parameter axis.
Parameters
----------
name: str
The name of this... | [
"def",
"add_reduce",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
",",
"axis",
",",
"mode",
",",
"epsilon",
"=",
"1e-6",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_la... | Add a reduce layer. Applies the function specified by the parameter mode,
along dimension(s) specified by the parameter axis.
Parameters
----------
name: str
The name of this layer.
input_name: str
The input blob name of this layer.
output_name: ... | [
"Add",
"a",
"reduce",
"layer",
".",
"Applies",
"the",
"function",
"specified",
"by",
"the",
"parameter",
"mode",
"along",
"dimension",
"(",
"s",
")",
"specified",
"by",
"the",
"parameter",
"axis",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2096-L2175 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_lrn | def add_lrn(self, name, input_name, output_name, alpha, beta, local_size, k = 1.0):
"""
Add a LRN (local response normalization) layer. Please see the LRNLayerParams message in Core ML neural network
protobuf for more information about the operation of this layer. Supports "across" channels norm... | python | def add_lrn(self, name, input_name, output_name, alpha, beta, local_size, k = 1.0):
"""
Add a LRN (local response normalization) layer. Please see the LRNLayerParams message in Core ML neural network
protobuf for more information about the operation of this layer. Supports "across" channels norm... | [
"def",
"add_lrn",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
",",
"alpha",
",",
"beta",
",",
"local_size",
",",
"k",
"=",
"1.0",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new laye... | Add a LRN (local response normalization) layer. Please see the LRNLayerParams message in Core ML neural network
protobuf for more information about the operation of this layer. Supports "across" channels normalization.
Parameters
----------
name: str
The name of this layer.
... | [
"Add",
"a",
"LRN",
"(",
"local",
"response",
"normalization",
")",
"layer",
".",
"Please",
"see",
"the",
"LRNLayerParams",
"message",
"in",
"Core",
"ML",
"neural",
"network",
"protobuf",
"for",
"more",
"information",
"about",
"the",
"operation",
"of",
"this",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2178-L2224 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_mvn | def add_mvn(self, name, input_name, output_name, across_channels = True, normalize_variance = True, epsilon = 1e-5):
"""
Add an MVN (mean variance normalization) layer. Computes mean, variance and normalizes the input.
Parameters
----------
name: str
The name of this... | python | def add_mvn(self, name, input_name, output_name, across_channels = True, normalize_variance = True, epsilon = 1e-5):
"""
Add an MVN (mean variance normalization) layer. Computes mean, variance and normalizes the input.
Parameters
----------
name: str
The name of this... | [
"def",
"add_mvn",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
",",
"across_channels",
"=",
"True",
",",
"normalize_variance",
"=",
"True",
",",
"epsilon",
"=",
"1e-5",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self... | Add an MVN (mean variance normalization) layer. Computes mean, variance and normalizes the input.
Parameters
----------
name: str
The name of this layer.
input_name: str
The input blob name of this layer.
output_name: str
The output blob name... | [
"Add",
"an",
"MVN",
"(",
"mean",
"variance",
"normalization",
")",
"layer",
".",
"Computes",
"mean",
"variance",
"and",
"normalizes",
"the",
"input",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2226-L2268 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_l2_normalize | def add_l2_normalize(self, name, input_name, output_name, epsilon = 1e-5):
"""
Add L2 normalize layer. Normalizes the input by the L2 norm, i.e. divides by the
the square root of the sum of squares of all elements of the input along C, H and W dimensions.
Parameters
----------
... | python | def add_l2_normalize(self, name, input_name, output_name, epsilon = 1e-5):
"""
Add L2 normalize layer. Normalizes the input by the L2 norm, i.e. divides by the
the square root of the sum of squares of all elements of the input along C, H and W dimensions.
Parameters
----------
... | [
"def",
"add_l2_normalize",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
",",
"epsilon",
"=",
"1e-5",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",
"=",
"nn_spec",
... | Add L2 normalize layer. Normalizes the input by the L2 norm, i.e. divides by the
the square root of the sum of squares of all elements of the input along C, H and W dimensions.
Parameters
----------
name: str
The name of this layer.
input_name: str
The i... | [
"Add",
"L2",
"normalize",
"layer",
".",
"Normalizes",
"the",
"input",
"by",
"the",
"L2",
"norm",
"i",
".",
"e",
".",
"divides",
"by",
"the",
"the",
"square",
"root",
"of",
"the",
"sum",
"of",
"squares",
"of",
"all",
"elements",
"of",
"the",
"input",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2271-L2305 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_unary | def add_unary(self, name, input_name, output_name, mode, alpha = 1.0,
shift = 0, scale = 1.0, epsilon = 1e-6):
"""
Add a Unary layer. Applies the specified function (mode) to all the elements of the input.
Please see the UnaryFunctionLayerParams message in Core ML neural netw... | python | def add_unary(self, name, input_name, output_name, mode, alpha = 1.0,
shift = 0, scale = 1.0, epsilon = 1e-6):
"""
Add a Unary layer. Applies the specified function (mode) to all the elements of the input.
Please see the UnaryFunctionLayerParams message in Core ML neural netw... | [
"def",
"add_unary",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_name",
",",
"mode",
",",
"alpha",
"=",
"1.0",
",",
"shift",
"=",
"0",
",",
"scale",
"=",
"1.0",
",",
"epsilon",
"=",
"1e-6",
")",
":",
"spec",
"=",
"self",
".",
"spec",
... | Add a Unary layer. Applies the specified function (mode) to all the elements of the input.
Please see the UnaryFunctionLayerParams message in Core ML neural network
protobuf for more information about the operation of this layer.
Prior to the application of the function the input can be scaled a... | [
"Add",
"a",
"Unary",
"layer",
".",
"Applies",
"the",
"specified",
"function",
"(",
"mode",
")",
"to",
"all",
"the",
"elements",
"of",
"the",
"input",
".",
"Please",
"see",
"the",
"UnaryFunctionLayerParams",
"message",
"in",
"Core",
"ML",
"neural",
"network",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2308-L2377 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_split | def add_split(self, name, input_name, output_names):
"""
Add a Split layer that uniformly splits the input along the channel dimension
to produce multiple outputs.
Parameters
----------
name: str
The name of this layer.
input_name: str
Th... | python | def add_split(self, name, input_name, output_names):
"""
Add a Split layer that uniformly splits the input along the channel dimension
to produce multiple outputs.
Parameters
----------
name: str
The name of this layer.
input_name: str
Th... | [
"def",
"add_split",
"(",
"self",
",",
"name",
",",
"input_name",
",",
"output_names",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",
"=",
"nn_spec",
".",
"layers",
".",
"add",
"(",
"... | Add a Split layer that uniformly splits the input along the channel dimension
to produce multiple outputs.
Parameters
----------
name: str
The name of this layer.
input_name: str
The input blob name of this layer.
output_names: [str]
... | [
"Add",
"a",
"Split",
"layer",
"that",
"uniformly",
"splits",
"the",
"input",
"along",
"the",
"channel",
"dimension",
"to",
"produce",
"multiple",
"outputs",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2379-L2409 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_load_constant | def add_load_constant(self, name, output_name, constant_value, shape):
"""
Add a load constant layer.
Parameters
----------
name: str
The name of this layer.
output_name: str
The output blob name of this layer.
constant_value: numpy.arra... | python | def add_load_constant(self, name, output_name, constant_value, shape):
"""
Add a load constant layer.
Parameters
----------
name: str
The name of this layer.
output_name: str
The output blob name of this layer.
constant_value: numpy.arra... | [
"def",
"add_load_constant",
"(",
"self",
",",
"name",
",",
"output_name",
",",
"constant_value",
",",
"shape",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# Add a new layer",
"spec_layer",
"=",
"nn_spec",
".",
"layers... | Add a load constant layer.
Parameters
----------
name: str
The name of this layer.
output_name: str
The output blob name of this layer.
constant_value: numpy.array
value of the constant as a numpy array.
shape: [int]
Lis... | [
"Add",
"a",
"load",
"constant",
"layer",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2411-L2452 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.add_custom | def add_custom(self, name, input_names, output_names, custom_proto_spec = None):
"""
Add a custom layer.
Parameters
----------
name: str
The name of this layer.
input_names: [str]
The input blob names to this layer.
output_names: [str]
... | python | def add_custom(self, name, input_names, output_names, custom_proto_spec = None):
"""
Add a custom layer.
Parameters
----------
name: str
The name of this layer.
input_names: [str]
The input blob names to this layer.
output_names: [str]
... | [
"def",
"add_custom",
"(",
"self",
",",
"name",
",",
"input_names",
",",
"output_names",
",",
"custom_proto_spec",
"=",
"None",
")",
":",
"spec",
"=",
"self",
".",
"spec",
"nn_spec",
"=",
"self",
".",
"nn_spec",
"# custom layers require a newer specification versio... | Add a custom layer.
Parameters
----------
name: str
The name of this layer.
input_names: [str]
The input blob names to this layer.
output_names: [str]
The output blob names from this layer.
custom_proto_spec: CustomLayerParams
... | [
"Add",
"a",
"custom",
"layer",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2455-L2491 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py | NeuralNetworkBuilder.set_pre_processing_parameters | def set_pre_processing_parameters(self, image_input_names = [], is_bgr = False,
red_bias = 0.0, green_bias = 0.0, blue_bias = 0.0, gray_bias = 0.0, image_scale = 1.0):
"""Add pre-processing parameters to the neural network object
Parameters
----------
image_input_names: [str... | python | def set_pre_processing_parameters(self, image_input_names = [], is_bgr = False,
red_bias = 0.0, green_bias = 0.0, blue_bias = 0.0, gray_bias = 0.0, image_scale = 1.0):
"""Add pre-processing parameters to the neural network object
Parameters
----------
image_input_names: [str... | [
"def",
"set_pre_processing_parameters",
"(",
"self",
",",
"image_input_names",
"=",
"[",
"]",
",",
"is_bgr",
"=",
"False",
",",
"red_bias",
"=",
"0.0",
",",
"green_bias",
"=",
"0.0",
",",
"blue_bias",
"=",
"0.0",
",",
"gray_bias",
"=",
"0.0",
",",
"image_s... | Add pre-processing parameters to the neural network object
Parameters
----------
image_input_names: [str]
Name of input blobs that are images
is_bgr: boolean | dict()
Channel order for input blobs that are images. BGR if True else RGB.
To specify a d... | [
"Add",
"pre",
"-",
"processing",
"parameters",
"to",
"the",
"neural",
"network",
"object"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2494-L2570 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/scanner.py | register | def register(scanner_class, relevant_properties):
""" Registers a new generator class, specifying a set of
properties relevant to this scanner. Ctor for that class
should have one parameter: list of properties.
"""
assert issubclass(scanner_class, Scanner)
assert isinstance(relevant_pro... | python | def register(scanner_class, relevant_properties):
""" Registers a new generator class, specifying a set of
properties relevant to this scanner. Ctor for that class
should have one parameter: list of properties.
"""
assert issubclass(scanner_class, Scanner)
assert isinstance(relevant_pro... | [
"def",
"register",
"(",
"scanner_class",
",",
"relevant_properties",
")",
":",
"assert",
"issubclass",
"(",
"scanner_class",
",",
"Scanner",
")",
"assert",
"isinstance",
"(",
"relevant_properties",
",",
"basestring",
")",
"__scanners",
"[",
"str",
"(",
"scanner_cl... | Registers a new generator class, specifying a set of
properties relevant to this scanner. Ctor for that class
should have one parameter: list of properties. | [
"Registers",
"a",
"new",
"generator",
"class",
"specifying",
"a",
"set",
"of",
"properties",
"relevant",
"to",
"this",
"scanner",
".",
"Ctor",
"for",
"that",
"class",
"should",
"have",
"one",
"parameter",
":",
"list",
"of",
"properties",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/scanner.py#L54-L61 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/scanner.py | get | def get(scanner_class, properties):
""" Returns an instance of previously registered scanner
with the specified properties.
"""
assert issubclass(scanner_class, Scanner)
assert is_iterable_typed(properties, basestring)
scanner_name = str(scanner_class)
if not registered(scanner_name):
... | python | def get(scanner_class, properties):
""" Returns an instance of previously registered scanner
with the specified properties.
"""
assert issubclass(scanner_class, Scanner)
assert is_iterable_typed(properties, basestring)
scanner_name = str(scanner_class)
if not registered(scanner_name):
... | [
"def",
"get",
"(",
"scanner_class",
",",
"properties",
")",
":",
"assert",
"issubclass",
"(",
"scanner_class",
",",
"Scanner",
")",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"basestring",
")",
"scanner_name",
"=",
"str",
"(",
"scanner_class",
")",
... | Returns an instance of previously registered scanner
with the specified properties. | [
"Returns",
"an",
"instance",
"of",
"previously",
"registered",
"scanner",
"with",
"the",
"specified",
"properties",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/scanner.py#L68-L87 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/scanner.py | ScannerRegistry.install | def install (self, scanner, target, vtarget):
""" Installs the specified scanner on actual target 'target'.
vtarget: virtual target from which 'target' was actualized.
"""
assert isinstance(scanner, Scanner)
assert isinstance(target, basestring)
assert isinstance(vtar... | python | def install (self, scanner, target, vtarget):
""" Installs the specified scanner on actual target 'target'.
vtarget: virtual target from which 'target' was actualized.
"""
assert isinstance(scanner, Scanner)
assert isinstance(target, basestring)
assert isinstance(vtar... | [
"def",
"install",
"(",
"self",
",",
"scanner",
",",
"target",
",",
"vtarget",
")",
":",
"assert",
"isinstance",
"(",
"scanner",
",",
"Scanner",
")",
"assert",
"isinstance",
"(",
"target",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"vtarget",
",",... | Installs the specified scanner on actual target 'target'.
vtarget: virtual target from which 'target' was actualized. | [
"Installs",
"the",
"specified",
"scanner",
"on",
"actual",
"target",
"target",
".",
"vtarget",
":",
"virtual",
"target",
"from",
"which",
"target",
"was",
"actualized",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/scanner.py#L133-L157 | train |
apple/turicreate | src/unity/python/turicreate/util/_cloudpickle.py | _fill_function | def _fill_function(func, globals, defaults, dict, module, closure_values):
""" Fills in the rest of function data into the skeleton function object
that were created via _make_skel_func().
"""
func.__globals__.update(globals)
func.__defaults__ = defaults
func.__dict__ = dict
func.__modul... | python | def _fill_function(func, globals, defaults, dict, module, closure_values):
""" Fills in the rest of function data into the skeleton function object
that were created via _make_skel_func().
"""
func.__globals__.update(globals)
func.__defaults__ = defaults
func.__dict__ = dict
func.__modul... | [
"def",
"_fill_function",
"(",
"func",
",",
"globals",
",",
"defaults",
",",
"dict",
",",
"module",
",",
"closure_values",
")",
":",
"func",
".",
"__globals__",
".",
"update",
"(",
"globals",
")",
"func",
".",
"__defaults__",
"=",
"defaults",
"func",
".",
... | Fills in the rest of function data into the skeleton function object
that were created via _make_skel_func(). | [
"Fills",
"in",
"the",
"rest",
"of",
"function",
"data",
"into",
"the",
"skeleton",
"function",
"object",
"that",
"were",
"created",
"via",
"_make_skel_func",
"()",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L1090-L1105 | train |
apple/turicreate | src/unity/python/turicreate/util/_cloudpickle.py | _make_skel_func | def _make_skel_func(code, cell_count, base_globals=None):
""" Creates a skeleton function object that contains just the provided
code and the correct number of cells in func_closure. All other
func attributes (e.g. func_globals) are empty.
"""
if base_globals is None:
base_globals =... | python | def _make_skel_func(code, cell_count, base_globals=None):
""" Creates a skeleton function object that contains just the provided
code and the correct number of cells in func_closure. All other
func attributes (e.g. func_globals) are empty.
"""
if base_globals is None:
base_globals =... | [
"def",
"_make_skel_func",
"(",
"code",
",",
"cell_count",
",",
"base_globals",
"=",
"None",
")",
":",
"if",
"base_globals",
"is",
"None",
":",
"base_globals",
"=",
"{",
"}",
"base_globals",
"[",
"'__builtins__'",
"]",
"=",
"__builtins__",
"closure",
"=",
"("... | Creates a skeleton function object that contains just the provided
code and the correct number of cells in func_closure. All other
func attributes (e.g. func_globals) are empty. | [
"Creates",
"a",
"skeleton",
"function",
"object",
"that",
"contains",
"just",
"the",
"provided",
"code",
"and",
"the",
"correct",
"number",
"of",
"cells",
"in",
"func_closure",
".",
"All",
"other",
"func",
"attributes",
"(",
"e",
".",
"g",
".",
"func_globals... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L1117-L1131 | train |
apple/turicreate | src/unity/python/turicreate/util/_cloudpickle.py | _rehydrate_skeleton_class | def _rehydrate_skeleton_class(skeleton_class, class_dict):
"""Put attributes from `class_dict` back on `skeleton_class`.
See CloudPickler.save_dynamic_class for more info.
"""
for attrname, attr in class_dict.items():
setattr(skeleton_class, attrname, attr)
return skeleton_class | python | def _rehydrate_skeleton_class(skeleton_class, class_dict):
"""Put attributes from `class_dict` back on `skeleton_class`.
See CloudPickler.save_dynamic_class for more info.
"""
for attrname, attr in class_dict.items():
setattr(skeleton_class, attrname, attr)
return skeleton_class | [
"def",
"_rehydrate_skeleton_class",
"(",
"skeleton_class",
",",
"class_dict",
")",
":",
"for",
"attrname",
",",
"attr",
"in",
"class_dict",
".",
"items",
"(",
")",
":",
"setattr",
"(",
"skeleton_class",
",",
"attrname",
",",
"attr",
")",
"return",
"skeleton_cl... | Put attributes from `class_dict` back on `skeleton_class`.
See CloudPickler.save_dynamic_class for more info. | [
"Put",
"attributes",
"from",
"class_dict",
"back",
"on",
"skeleton_class",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L1134-L1141 | train |
apple/turicreate | src/unity/python/turicreate/util/_cloudpickle.py | _find_module | def _find_module(mod_name):
"""
Iterate over each part instead of calling imp.find_module directly.
This function is able to find submodules (e.g. sickit.tree)
"""
path = None
for part in mod_name.split('.'):
if path is not None:
path = [path]
file, path, description ... | python | def _find_module(mod_name):
"""
Iterate over each part instead of calling imp.find_module directly.
This function is able to find submodules (e.g. sickit.tree)
"""
path = None
for part in mod_name.split('.'):
if path is not None:
path = [path]
file, path, description ... | [
"def",
"_find_module",
"(",
"mod_name",
")",
":",
"path",
"=",
"None",
"for",
"part",
"in",
"mod_name",
".",
"split",
"(",
"'.'",
")",
":",
"if",
"path",
"is",
"not",
"None",
":",
"path",
"=",
"[",
"path",
"]",
"file",
",",
"path",
",",
"descriptio... | Iterate over each part instead of calling imp.find_module directly.
This function is able to find submodules (e.g. sickit.tree) | [
"Iterate",
"over",
"each",
"part",
"instead",
"of",
"calling",
"imp",
".",
"find_module",
"directly",
".",
"This",
"function",
"is",
"able",
"to",
"find",
"submodules",
"(",
"e",
".",
"g",
".",
"sickit",
".",
"tree",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L1144-L1156 | train |
apple/turicreate | src/unity/python/turicreate/util/_cloudpickle.py | CloudPickler.save_module | def save_module(self, obj):
"""
Save a module as an import
"""
mod_name = obj.__name__
# If module is successfully found then it is not a dynamically created module
if hasattr(obj, '__file__'):
is_dynamic = False
else:
try:
... | python | def save_module(self, obj):
"""
Save a module as an import
"""
mod_name = obj.__name__
# If module is successfully found then it is not a dynamically created module
if hasattr(obj, '__file__'):
is_dynamic = False
else:
try:
... | [
"def",
"save_module",
"(",
"self",
",",
"obj",
")",
":",
"mod_name",
"=",
"obj",
".",
"__name__",
"# If module is successfully found then it is not a dynamically created module",
"if",
"hasattr",
"(",
"obj",
",",
"'__file__'",
")",
":",
"is_dynamic",
"=",
"False",
"... | Save a module as an import | [
"Save",
"a",
"module",
"as",
"an",
"import"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L285-L304 | train |
apple/turicreate | src/unity/python/turicreate/util/_cloudpickle.py | CloudPickler._save_subimports | def _save_subimports(self, code, top_level_dependencies):
"""
Ensure de-pickler imports any package child-modules that
are needed by the function
"""
# check if any known dependency is an imported package
for x in top_level_dependencies:
if isinstance(x, types... | python | def _save_subimports(self, code, top_level_dependencies):
"""
Ensure de-pickler imports any package child-modules that
are needed by the function
"""
# check if any known dependency is an imported package
for x in top_level_dependencies:
if isinstance(x, types... | [
"def",
"_save_subimports",
"(",
"self",
",",
"code",
",",
"top_level_dependencies",
")",
":",
"# check if any known dependency is an imported package",
"for",
"x",
"in",
"top_level_dependencies",
":",
"if",
"isinstance",
"(",
"x",
",",
"types",
".",
"ModuleType",
")",... | Ensure de-pickler imports any package child-modules that
are needed by the function | [
"Ensure",
"de",
"-",
"pickler",
"imports",
"any",
"package",
"child",
"-",
"modules",
"that",
"are",
"needed",
"by",
"the",
"function"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L405-L424 | train |
apple/turicreate | src/unity/python/turicreate/util/_cloudpickle.py | CloudPickler.save_dynamic_class | def save_dynamic_class(self, obj):
"""
Save a class that can't be stored as module global.
This method is used to serialize classes that are defined inside
functions, or that otherwise can't be serialized as attribute lookups
from global modules.
"""
clsdict = di... | python | def save_dynamic_class(self, obj):
"""
Save a class that can't be stored as module global.
This method is used to serialize classes that are defined inside
functions, or that otherwise can't be serialized as attribute lookups
from global modules.
"""
clsdict = di... | [
"def",
"save_dynamic_class",
"(",
"self",
",",
"obj",
")",
":",
"clsdict",
"=",
"dict",
"(",
"obj",
".",
"__dict__",
")",
"# copy dict proxy to a dict",
"if",
"not",
"isinstance",
"(",
"clsdict",
".",
"get",
"(",
"'__dict__'",
",",
"None",
")",
",",
"prope... | Save a class that can't be stored as module global.
This method is used to serialize classes that are defined inside
functions, or that otherwise can't be serialized as attribute lookups
from global modules. | [
"Save",
"a",
"class",
"that",
"can",
"t",
"be",
"stored",
"as",
"module",
"global",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L426-L494 | train |
apple/turicreate | src/unity/python/turicreate/util/_cloudpickle.py | CloudPickler.save_function_tuple | def save_function_tuple(self, func):
""" Pickles an actual func object.
A func comprises: code, globals, defaults, closure, and dict. We
extract and save these, injecting reducing functions at certain points
to recreate the func object. Keep in mind that some of these pieces
... | python | def save_function_tuple(self, func):
""" Pickles an actual func object.
A func comprises: code, globals, defaults, closure, and dict. We
extract and save these, injecting reducing functions at certain points
to recreate the func object. Keep in mind that some of these pieces
... | [
"def",
"save_function_tuple",
"(",
"self",
",",
"func",
")",
":",
"if",
"is_tornado_coroutine",
"(",
"func",
")",
":",
"self",
".",
"save_reduce",
"(",
"_rebuild_tornado_coroutine",
",",
"(",
"func",
".",
"__wrapped__",
",",
")",
",",
"obj",
"=",
"func",
"... | Pickles an actual func object.
A func comprises: code, globals, defaults, closure, and dict. We
extract and save these, injecting reducing functions at certain points
to recreate the func object. Keep in mind that some of these pieces
can contain a ref to the func itself. Thus, a nai... | [
"Pickles",
"an",
"actual",
"func",
"object",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L496-L543 | train |
apple/turicreate | src/unity/python/turicreate/util/_cloudpickle.py | CloudPickler.extract_code_globals | def extract_code_globals(cls, co):
"""
Find all globals names read or written to by codeblock co
"""
out_names = cls._extract_code_globals_cache.get(co)
if out_names is None:
try:
names = co.co_names
except AttributeError:
#... | python | def extract_code_globals(cls, co):
"""
Find all globals names read or written to by codeblock co
"""
out_names = cls._extract_code_globals_cache.get(co)
if out_names is None:
try:
names = co.co_names
except AttributeError:
#... | [
"def",
"extract_code_globals",
"(",
"cls",
",",
"co",
")",
":",
"out_names",
"=",
"cls",
".",
"_extract_code_globals_cache",
".",
"get",
"(",
"co",
")",
"if",
"out_names",
"is",
"None",
":",
"try",
":",
"names",
"=",
"co",
".",
"co_names",
"except",
"Att... | Find all globals names read or written to by codeblock co | [
"Find",
"all",
"globals",
"names",
"read",
"or",
"written",
"to",
"by",
"codeblock",
"co"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L551-L574 | train |
apple/turicreate | src/unity/python/turicreate/util/_cloudpickle.py | CloudPickler.save_global | def save_global(self, obj, name=None, pack=struct.pack):
"""
Save a "global".
The name of this method is somewhat misleading: all types get
dispatched here.
"""
if obj.__module__ == "__builtin__" or obj.__module__ == "builtins":
if obj in _BUILTIN_TYPE_NAMES:... | python | def save_global(self, obj, name=None, pack=struct.pack):
"""
Save a "global".
The name of this method is somewhat misleading: all types get
dispatched here.
"""
if obj.__module__ == "__builtin__" or obj.__module__ == "builtins":
if obj in _BUILTIN_TYPE_NAMES:... | [
"def",
"save_global",
"(",
"self",
",",
"obj",
",",
"name",
"=",
"None",
",",
"pack",
"=",
"struct",
".",
"pack",
")",
":",
"if",
"obj",
".",
"__module__",
"==",
"\"__builtin__\"",
"or",
"obj",
".",
"__module__",
"==",
"\"builtins\"",
":",
"if",
"obj",... | Save a "global".
The name of this method is somewhat misleading: all types get
dispatched here. | [
"Save",
"a",
"global",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L616-L653 | train |
apple/turicreate | src/unity/python/turicreate/util/_cloudpickle.py | CloudPickler.save_reduce | def save_reduce(self, func, args, state=None,
listitems=None, dictitems=None, obj=None):
"""Modified to support __transient__ on new objects
Change only affects protocol level 2 (which is always used by PiCloud"""
# Assert that args is a tuple or None
if not isinstanc... | python | def save_reduce(self, func, args, state=None,
listitems=None, dictitems=None, obj=None):
"""Modified to support __transient__ on new objects
Change only affects protocol level 2 (which is always used by PiCloud"""
# Assert that args is a tuple or None
if not isinstanc... | [
"def",
"save_reduce",
"(",
"self",
",",
"func",
",",
"args",
",",
"state",
"=",
"None",
",",
"listitems",
"=",
"None",
",",
"dictitems",
"=",
"None",
",",
"obj",
"=",
"None",
")",
":",
"# Assert that args is a tuple or None",
"if",
"not",
"isinstance",
"("... | Modified to support __transient__ on new objects
Change only affects protocol level 2 (which is always used by PiCloud | [
"Modified",
"to",
"support",
"__transient__",
"on",
"new",
"objects",
"Change",
"only",
"affects",
"protocol",
"level",
"2",
"(",
"which",
"is",
"always",
"used",
"by",
"PiCloud"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L777-L837 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.