repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool.AddExtensionDescriptor | def AddExtensionDescriptor(self, extension):
"""Adds a FieldDescriptor describing an extension to the pool.
Args:
extension: A FieldDescriptor.
Raises:
AssertionError: when another extension with the same number extends the
same message.
TypeError: when the specified extension is... | python | def AddExtensionDescriptor(self, extension):
"""Adds a FieldDescriptor describing an extension to the pool.
Args:
extension: A FieldDescriptor.
Raises:
AssertionError: when another extension with the same number extends the
same message.
TypeError: when the specified extension is... | [
"def",
"AddExtensionDescriptor",
"(",
"self",
",",
"extension",
")",
":",
"if",
"not",
"(",
"isinstance",
"(",
"extension",
",",
"descriptor",
".",
"FieldDescriptor",
")",
"and",
"extension",
".",
"is_extension",
")",
":",
"raise",
"TypeError",
"(",
"'Expected... | Adds a FieldDescriptor describing an extension to the pool.
Args:
extension: A FieldDescriptor.
Raises:
AssertionError: when another extension with the same number extends the
same message.
TypeError: when the specified extension is not a
descriptor.FieldDescriptor. | [
"Adds",
"a",
"FieldDescriptor",
"describing",
"an",
"extension",
"to",
"the",
"pool",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L205-L245 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool.AddFileDescriptor | def AddFileDescriptor(self, file_desc):
"""Adds a FileDescriptor to the pool, non-recursively.
If the FileDescriptor contains messages or enums, the caller must explicitly
register them.
Args:
file_desc: A FileDescriptor.
"""
self._AddFileDescriptor(file_desc)
# TODO(jieluo): This i... | python | def AddFileDescriptor(self, file_desc):
"""Adds a FileDescriptor to the pool, non-recursively.
If the FileDescriptor contains messages or enums, the caller must explicitly
register them.
Args:
file_desc: A FileDescriptor.
"""
self._AddFileDescriptor(file_desc)
# TODO(jieluo): This i... | [
"def",
"AddFileDescriptor",
"(",
"self",
",",
"file_desc",
")",
":",
"self",
".",
"_AddFileDescriptor",
"(",
"file_desc",
")",
"# TODO(jieluo): This is a temporary solution for FieldDescriptor.file.",
"# Remove it when FieldDescriptor.file is added in code gen.",
"for",
"extension"... | Adds a FileDescriptor to the pool, non-recursively.
If the FileDescriptor contains messages or enums, the caller must explicitly
register them.
Args:
file_desc: A FileDescriptor. | [
"Adds",
"a",
"FileDescriptor",
"to",
"the",
"pool",
"non",
"-",
"recursively",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L247-L262 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool._AddFileDescriptor | def _AddFileDescriptor(self, file_desc):
"""Adds a FileDescriptor to the pool, non-recursively.
If the FileDescriptor contains messages or enums, the caller must explicitly
register them.
Args:
file_desc: A FileDescriptor.
"""
if not isinstance(file_desc, descriptor.FileDescriptor):
... | python | def _AddFileDescriptor(self, file_desc):
"""Adds a FileDescriptor to the pool, non-recursively.
If the FileDescriptor contains messages or enums, the caller must explicitly
register them.
Args:
file_desc: A FileDescriptor.
"""
if not isinstance(file_desc, descriptor.FileDescriptor):
... | [
"def",
"_AddFileDescriptor",
"(",
"self",
",",
"file_desc",
")",
":",
"if",
"not",
"isinstance",
"(",
"file_desc",
",",
"descriptor",
".",
"FileDescriptor",
")",
":",
"raise",
"TypeError",
"(",
"'Expected instance of descriptor.FileDescriptor.'",
")",
"self",
".",
... | Adds a FileDescriptor to the pool, non-recursively.
If the FileDescriptor contains messages or enums, the caller must explicitly
register them.
Args:
file_desc: A FileDescriptor. | [
"Adds",
"a",
"FileDescriptor",
"to",
"the",
"pool",
"non",
"-",
"recursively",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L264-L276 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool.FindFileByName | def FindFileByName(self, file_name):
"""Gets a FileDescriptor by file name.
Args:
file_name: The path to the file to get a descriptor for.
Returns:
A FileDescriptor for the named file.
Raises:
KeyError: if the file cannot be found in the pool.
"""
try:
return self._fi... | python | def FindFileByName(self, file_name):
"""Gets a FileDescriptor by file name.
Args:
file_name: The path to the file to get a descriptor for.
Returns:
A FileDescriptor for the named file.
Raises:
KeyError: if the file cannot be found in the pool.
"""
try:
return self._fi... | [
"def",
"FindFileByName",
"(",
"self",
",",
"file_name",
")",
":",
"try",
":",
"return",
"self",
".",
"_file_descriptors",
"[",
"file_name",
"]",
"except",
"KeyError",
":",
"pass",
"try",
":",
"file_proto",
"=",
"self",
".",
"_internal_db",
".",
"FindFileByNa... | Gets a FileDescriptor by file name.
Args:
file_name: The path to the file to get a descriptor for.
Returns:
A FileDescriptor for the named file.
Raises:
KeyError: if the file cannot be found in the pool. | [
"Gets",
"a",
"FileDescriptor",
"by",
"file",
"name",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L278-L305 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool.FindFileContainingSymbol | def FindFileContainingSymbol(self, symbol):
"""Gets the FileDescriptor for the file containing the specified symbol.
Args:
symbol: The name of the symbol to search for.
Returns:
A FileDescriptor that contains the specified symbol.
Raises:
KeyError: if the file cannot be found in the... | python | def FindFileContainingSymbol(self, symbol):
"""Gets the FileDescriptor for the file containing the specified symbol.
Args:
symbol: The name of the symbol to search for.
Returns:
A FileDescriptor that contains the specified symbol.
Raises:
KeyError: if the file cannot be found in the... | [
"def",
"FindFileContainingSymbol",
"(",
"self",
",",
"symbol",
")",
":",
"symbol",
"=",
"_NormalizeFullyQualifiedName",
"(",
"symbol",
")",
"try",
":",
"return",
"self",
".",
"_descriptors",
"[",
"symbol",
"]",
".",
"file",
"except",
"KeyError",
":",
"pass",
... | Gets the FileDescriptor for the file containing the specified symbol.
Args:
symbol: The name of the symbol to search for.
Returns:
A FileDescriptor that contains the specified symbol.
Raises:
KeyError: if the file cannot be found in the pool. | [
"Gets",
"the",
"FileDescriptor",
"for",
"the",
"file",
"containing",
"the",
"specified",
"symbol",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L307-L349 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool.FindMessageTypeByName | def FindMessageTypeByName(self, full_name):
"""Loads the named descriptor from the pool.
Args:
full_name: The full name of the descriptor to load.
Returns:
The descriptor for the named type.
Raises:
KeyError: if the message cannot be found in the pool.
"""
full_name = _Norm... | python | def FindMessageTypeByName(self, full_name):
"""Loads the named descriptor from the pool.
Args:
full_name: The full name of the descriptor to load.
Returns:
The descriptor for the named type.
Raises:
KeyError: if the message cannot be found in the pool.
"""
full_name = _Norm... | [
"def",
"FindMessageTypeByName",
"(",
"self",
",",
"full_name",
")",
":",
"full_name",
"=",
"_NormalizeFullyQualifiedName",
"(",
"full_name",
")",
"if",
"full_name",
"not",
"in",
"self",
".",
"_descriptors",
":",
"self",
".",
"_FindFileContainingSymbolInDb",
"(",
"... | Loads the named descriptor from the pool.
Args:
full_name: The full name of the descriptor to load.
Returns:
The descriptor for the named type.
Raises:
KeyError: if the message cannot be found in the pool. | [
"Loads",
"the",
"named",
"descriptor",
"from",
"the",
"pool",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L351-L367 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool.FindEnumTypeByName | def FindEnumTypeByName(self, full_name):
"""Loads the named enum descriptor from the pool.
Args:
full_name: The full name of the enum descriptor to load.
Returns:
The enum descriptor for the named type.
Raises:
KeyError: if the enum cannot be found in the pool.
"""
full_nam... | python | def FindEnumTypeByName(self, full_name):
"""Loads the named enum descriptor from the pool.
Args:
full_name: The full name of the enum descriptor to load.
Returns:
The enum descriptor for the named type.
Raises:
KeyError: if the enum cannot be found in the pool.
"""
full_nam... | [
"def",
"FindEnumTypeByName",
"(",
"self",
",",
"full_name",
")",
":",
"full_name",
"=",
"_NormalizeFullyQualifiedName",
"(",
"full_name",
")",
"if",
"full_name",
"not",
"in",
"self",
".",
"_enum_descriptors",
":",
"self",
".",
"_FindFileContainingSymbolInDb",
"(",
... | Loads the named enum descriptor from the pool.
Args:
full_name: The full name of the enum descriptor to load.
Returns:
The enum descriptor for the named type.
Raises:
KeyError: if the enum cannot be found in the pool. | [
"Loads",
"the",
"named",
"enum",
"descriptor",
"from",
"the",
"pool",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L369-L385 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool.FindFieldByName | def FindFieldByName(self, full_name):
"""Loads the named field descriptor from the pool.
Args:
full_name: The full name of the field descriptor to load.
Returns:
The field descriptor for the named field.
Raises:
KeyError: if the field cannot be found in the pool.
"""
full_na... | python | def FindFieldByName(self, full_name):
"""Loads the named field descriptor from the pool.
Args:
full_name: The full name of the field descriptor to load.
Returns:
The field descriptor for the named field.
Raises:
KeyError: if the field cannot be found in the pool.
"""
full_na... | [
"def",
"FindFieldByName",
"(",
"self",
",",
"full_name",
")",
":",
"full_name",
"=",
"_NormalizeFullyQualifiedName",
"(",
"full_name",
")",
"message_name",
",",
"_",
",",
"field_name",
"=",
"full_name",
".",
"rpartition",
"(",
"'.'",
")",
"message_descriptor",
"... | Loads the named field descriptor from the pool.
Args:
full_name: The full name of the field descriptor to load.
Returns:
The field descriptor for the named field.
Raises:
KeyError: if the field cannot be found in the pool. | [
"Loads",
"the",
"named",
"field",
"descriptor",
"from",
"the",
"pool",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L387-L402 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool.FindServiceByName | def FindServiceByName(self, full_name):
"""Loads the named service descriptor from the pool.
Args:
full_name: The full name of the service descriptor to load.
Returns:
The service descriptor for the named service.
Raises:
KeyError: if the service cannot be found in the pool.
"""... | python | def FindServiceByName(self, full_name):
"""Loads the named service descriptor from the pool.
Args:
full_name: The full name of the service descriptor to load.
Returns:
The service descriptor for the named service.
Raises:
KeyError: if the service cannot be found in the pool.
"""... | [
"def",
"FindServiceByName",
"(",
"self",
",",
"full_name",
")",
":",
"full_name",
"=",
"_NormalizeFullyQualifiedName",
"(",
"full_name",
")",
"if",
"full_name",
"not",
"in",
"self",
".",
"_service_descriptors",
":",
"self",
".",
"_FindFileContainingSymbolInDb",
"(",... | Loads the named service descriptor from the pool.
Args:
full_name: The full name of the service descriptor to load.
Returns:
The service descriptor for the named service.
Raises:
KeyError: if the service cannot be found in the pool. | [
"Loads",
"the",
"named",
"service",
"descriptor",
"from",
"the",
"pool",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L467-L482 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool._FindFileContainingSymbolInDb | def _FindFileContainingSymbolInDb(self, symbol):
"""Finds the file in descriptor DB containing the specified symbol.
Args:
symbol: The name of the symbol to search for.
Returns:
A FileDescriptor that contains the specified symbol.
Raises:
KeyError: if the file cannot be found in the... | python | def _FindFileContainingSymbolInDb(self, symbol):
"""Finds the file in descriptor DB containing the specified symbol.
Args:
symbol: The name of the symbol to search for.
Returns:
A FileDescriptor that contains the specified symbol.
Raises:
KeyError: if the file cannot be found in the... | [
"def",
"_FindFileContainingSymbolInDb",
"(",
"self",
",",
"symbol",
")",
":",
"try",
":",
"file_proto",
"=",
"self",
".",
"_internal_db",
".",
"FindFileContainingSymbol",
"(",
"symbol",
")",
"except",
"KeyError",
"as",
"error",
":",
"if",
"self",
".",
"_descri... | Finds the file in descriptor DB containing the specified symbol.
Args:
symbol: The name of the symbol to search for.
Returns:
A FileDescriptor that contains the specified symbol.
Raises:
KeyError: if the file cannot be found in the descriptor database. | [
"Finds",
"the",
"file",
"in",
"descriptor",
"DB",
"containing",
"the",
"specified",
"symbol",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L484-L505 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool._ConvertFileProtoToFileDescriptor | def _ConvertFileProtoToFileDescriptor(self, file_proto):
"""Creates a FileDescriptor from a proto or returns a cached copy.
This method also has the side effect of loading all the symbols found in
the file into the appropriate dictionaries in the pool.
Args:
file_proto: The proto to convert.
... | python | def _ConvertFileProtoToFileDescriptor(self, file_proto):
"""Creates a FileDescriptor from a proto or returns a cached copy.
This method also has the side effect of loading all the symbols found in
the file into the appropriate dictionaries in the pool.
Args:
file_proto: The proto to convert.
... | [
"def",
"_ConvertFileProtoToFileDescriptor",
"(",
"self",
",",
"file_proto",
")",
":",
"if",
"file_proto",
".",
"name",
"not",
"in",
"self",
".",
"_file_descriptors",
":",
"built_deps",
"=",
"list",
"(",
"self",
".",
"_GetDeps",
"(",
"file_proto",
".",
"depende... | Creates a FileDescriptor from a proto or returns a cached copy.
This method also has the side effect of loading all the symbols found in
the file into the appropriate dictionaries in the pool.
Args:
file_proto: The proto to convert.
Returns:
A FileDescriptor matching the passed in proto. | [
"Creates",
"a",
"FileDescriptor",
"from",
"a",
"proto",
"or",
"returns",
"a",
"cached",
"copy",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L507-L589 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool._ConvertMessageDescriptor | def _ConvertMessageDescriptor(self, desc_proto, package=None, file_desc=None,
scope=None, syntax=None):
"""Adds the proto to the pool in the specified package.
Args:
desc_proto: The descriptor_pb2.DescriptorProto protobuf message.
package: The package the proto shoul... | python | def _ConvertMessageDescriptor(self, desc_proto, package=None, file_desc=None,
scope=None, syntax=None):
"""Adds the proto to the pool in the specified package.
Args:
desc_proto: The descriptor_pb2.DescriptorProto protobuf message.
package: The package the proto shoul... | [
"def",
"_ConvertMessageDescriptor",
"(",
"self",
",",
"desc_proto",
",",
"package",
"=",
"None",
",",
"file_desc",
"=",
"None",
",",
"scope",
"=",
"None",
",",
"syntax",
"=",
"None",
")",
":",
"if",
"package",
":",
"desc_name",
"=",
"'.'",
".",
"join",
... | Adds the proto to the pool in the specified package.
Args:
desc_proto: The descriptor_pb2.DescriptorProto protobuf message.
package: The package the proto should be located in.
file_desc: The file containing this message.
scope: Dict mapping short and full symbols to message and enum types.... | [
"Adds",
"the",
"proto",
"to",
"the",
"pool",
"in",
"the",
"specified",
"package",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L591-L670 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool._SetAllFieldTypes | def _SetAllFieldTypes(self, package, desc_proto, scope):
"""Sets all the descriptor's fields's types.
This method also sets the containing types on any extensions.
Args:
package: The current package of desc_proto.
desc_proto: The message descriptor to update.
scope: Enclosing scope of av... | python | def _SetAllFieldTypes(self, package, desc_proto, scope):
"""Sets all the descriptor's fields's types.
This method also sets the containing types on any extensions.
Args:
package: The current package of desc_proto.
desc_proto: The message descriptor to update.
scope: Enclosing scope of av... | [
"def",
"_SetAllFieldTypes",
"(",
"self",
",",
"package",
",",
"desc_proto",
",",
"scope",
")",
":",
"package",
"=",
"_PrefixWithDot",
"(",
"package",
")",
"main_desc",
"=",
"self",
".",
"_GetTypeFromScope",
"(",
"package",
",",
"desc_proto",
".",
"name",
","... | Sets all the descriptor's fields's types.
This method also sets the containing types on any extensions.
Args:
package: The current package of desc_proto.
desc_proto: The message descriptor to update.
scope: Enclosing scope of available types. | [
"Sets",
"all",
"the",
"descriptor",
"s",
"fields",
"s",
"types",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L752-L782 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool._SetFieldType | def _SetFieldType(self, field_proto, field_desc, package, scope):
"""Sets the field's type, cpp_type, message_type and enum_type.
Args:
field_proto: Data about the field in proto format.
field_desc: The descriptor to modiy.
package: The package the field's container is in.
scope: Enclos... | python | def _SetFieldType(self, field_proto, field_desc, package, scope):
"""Sets the field's type, cpp_type, message_type and enum_type.
Args:
field_proto: Data about the field in proto format.
field_desc: The descriptor to modiy.
package: The package the field's container is in.
scope: Enclos... | [
"def",
"_SetFieldType",
"(",
"self",
",",
"field_proto",
",",
"field_desc",
",",
"package",
",",
"scope",
")",
":",
"if",
"field_proto",
".",
"type_name",
":",
"desc",
"=",
"self",
".",
"_GetTypeFromScope",
"(",
"package",
",",
"field_proto",
".",
"type_name... | Sets the field's type, cpp_type, message_type and enum_type.
Args:
field_proto: Data about the field in proto format.
field_desc: The descriptor to modiy.
package: The package the field's container is in.
scope: Enclosing scope of available types. | [
"Sets",
"the",
"field",
"s",
"type",
"cpp_type",
"message_type",
"and",
"enum_type",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L784-L852 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool._MakeEnumValueDescriptor | def _MakeEnumValueDescriptor(self, value_proto, index):
"""Creates a enum value descriptor object from a enum value proto.
Args:
value_proto: The proto describing the enum value.
index: The index of the enum value.
Returns:
An initialized EnumValueDescriptor object.
"""
return d... | python | def _MakeEnumValueDescriptor(self, value_proto, index):
"""Creates a enum value descriptor object from a enum value proto.
Args:
value_proto: The proto describing the enum value.
index: The index of the enum value.
Returns:
An initialized EnumValueDescriptor object.
"""
return d... | [
"def",
"_MakeEnumValueDescriptor",
"(",
"self",
",",
"value_proto",
",",
"index",
")",
":",
"return",
"descriptor",
".",
"EnumValueDescriptor",
"(",
"name",
"=",
"value_proto",
".",
"name",
",",
"index",
"=",
"index",
",",
"number",
"=",
"value_proto",
".",
... | Creates a enum value descriptor object from a enum value proto.
Args:
value_proto: The proto describing the enum value.
index: The index of the enum value.
Returns:
An initialized EnumValueDescriptor object. | [
"Creates",
"a",
"enum",
"value",
"descriptor",
"object",
"from",
"a",
"enum",
"value",
"proto",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L854-L870 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool._MakeServiceDescriptor | def _MakeServiceDescriptor(self, service_proto, service_index, scope,
package, file_desc):
"""Make a protobuf ServiceDescriptor given a ServiceDescriptorProto.
Args:
service_proto: The descriptor_pb2.ServiceDescriptorProto protobuf message.
service_index: The index of t... | python | def _MakeServiceDescriptor(self, service_proto, service_index, scope,
package, file_desc):
"""Make a protobuf ServiceDescriptor given a ServiceDescriptorProto.
Args:
service_proto: The descriptor_pb2.ServiceDescriptorProto protobuf message.
service_index: The index of t... | [
"def",
"_MakeServiceDescriptor",
"(",
"self",
",",
"service_proto",
",",
"service_index",
",",
"scope",
",",
"package",
",",
"file_desc",
")",
":",
"if",
"package",
":",
"service_name",
"=",
"'.'",
".",
"join",
"(",
"(",
"package",
",",
"service_proto",
".",... | Make a protobuf ServiceDescriptor given a ServiceDescriptorProto.
Args:
service_proto: The descriptor_pb2.ServiceDescriptorProto protobuf message.
service_index: The index of the service in the File.
scope: Dict mapping short and full symbols to message and enum types.
package: Optional pac... | [
"Make",
"a",
"protobuf",
"ServiceDescriptor",
"given",
"a",
"ServiceDescriptorProto",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L872-L902 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool._MakeMethodDescriptor | def _MakeMethodDescriptor(self, method_proto, service_name, package, scope,
index):
"""Creates a method descriptor from a MethodDescriptorProto.
Args:
method_proto: The proto describing the method.
service_name: The name of the containing service.
package: Optional... | python | def _MakeMethodDescriptor(self, method_proto, service_name, package, scope,
index):
"""Creates a method descriptor from a MethodDescriptorProto.
Args:
method_proto: The proto describing the method.
service_name: The name of the containing service.
package: Optional... | [
"def",
"_MakeMethodDescriptor",
"(",
"self",
",",
"method_proto",
",",
"service_name",
",",
"package",
",",
"scope",
",",
"index",
")",
":",
"full_name",
"=",
"'.'",
".",
"join",
"(",
"(",
"service_name",
",",
"method_proto",
".",
"name",
")",
")",
"input_... | Creates a method descriptor from a MethodDescriptorProto.
Args:
method_proto: The proto describing the method.
service_name: The name of the containing service.
package: Optional package name to look up for types.
scope: Scope containing available types.
index: Index of the method in ... | [
"Creates",
"a",
"method",
"descriptor",
"from",
"a",
"MethodDescriptorProto",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L904-L929 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool._ExtractSymbols | def _ExtractSymbols(self, descriptors):
"""Pulls out all the symbols from descriptor protos.
Args:
descriptors: The messages to extract descriptors from.
Yields:
A two element tuple of the type name and descriptor object.
"""
for desc in descriptors:
yield (_PrefixWithDot(desc.fu... | python | def _ExtractSymbols(self, descriptors):
"""Pulls out all the symbols from descriptor protos.
Args:
descriptors: The messages to extract descriptors from.
Yields:
A two element tuple of the type name and descriptor object.
"""
for desc in descriptors:
yield (_PrefixWithDot(desc.fu... | [
"def",
"_ExtractSymbols",
"(",
"self",
",",
"descriptors",
")",
":",
"for",
"desc",
"in",
"descriptors",
":",
"yield",
"(",
"_PrefixWithDot",
"(",
"desc",
".",
"full_name",
")",
",",
"desc",
")",
"for",
"symbol",
"in",
"self",
".",
"_ExtractSymbols",
"(",
... | Pulls out all the symbols from descriptor protos.
Args:
descriptors: The messages to extract descriptors from.
Yields:
A two element tuple of the type name and descriptor object. | [
"Pulls",
"out",
"all",
"the",
"symbols",
"from",
"descriptor",
"protos",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L931-L945 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool._GetDeps | def _GetDeps(self, dependencies):
"""Recursively finds dependencies for file protos.
Args:
dependencies: The names of the files being depended on.
Yields:
Each direct and indirect dependency.
"""
for dependency in dependencies:
dep_desc = self.FindFileByName(dependency)
yi... | python | def _GetDeps(self, dependencies):
"""Recursively finds dependencies for file protos.
Args:
dependencies: The names of the files being depended on.
Yields:
Each direct and indirect dependency.
"""
for dependency in dependencies:
dep_desc = self.FindFileByName(dependency)
yi... | [
"def",
"_GetDeps",
"(",
"self",
",",
"dependencies",
")",
":",
"for",
"dependency",
"in",
"dependencies",
":",
"dep_desc",
"=",
"self",
".",
"FindFileByName",
"(",
"dependency",
")",
"yield",
"dep_desc",
"for",
"parent_dep",
"in",
"dep_desc",
".",
"dependencie... | Recursively finds dependencies for file protos.
Args:
dependencies: The names of the files being depended on.
Yields:
Each direct and indirect dependency. | [
"Recursively",
"finds",
"dependencies",
"for",
"file",
"protos",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L947-L961 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool._GetTypeFromScope | def _GetTypeFromScope(self, package, type_name, scope):
"""Finds a given type name in the current scope.
Args:
package: The package the proto should be located in.
type_name: The name of the type to be found in the scope.
scope: Dict mapping short and full symbols to message and enum types.
... | python | def _GetTypeFromScope(self, package, type_name, scope):
"""Finds a given type name in the current scope.
Args:
package: The package the proto should be located in.
type_name: The name of the type to be found in the scope.
scope: Dict mapping short and full symbols to message and enum types.
... | [
"def",
"_GetTypeFromScope",
"(",
"self",
",",
"package",
",",
"type_name",
",",
"scope",
")",
":",
"if",
"type_name",
"not",
"in",
"scope",
":",
"components",
"=",
"_PrefixWithDot",
"(",
"package",
")",
".",
"split",
"(",
"'.'",
")",
"while",
"components",... | Finds a given type name in the current scope.
Args:
package: The package the proto should be located in.
type_name: The name of the type to be found in the scope.
scope: Dict mapping short and full symbols to message and enum types.
Returns:
The descriptor for the requested type. | [
"Finds",
"a",
"given",
"type",
"name",
"in",
"the",
"current",
"scope",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L963-L983 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/util/sequence.py | max_element | def max_element (elements, ordered = None):
""" Returns the maximum number in 'elements'. Uses 'ordered' for comparisons,
or '<' is none is provided.
"""
assert is_iterable(elements)
assert callable(ordered) or ordered is None
if not ordered: ordered = operator.lt
max = elements [0]
... | python | def max_element (elements, ordered = None):
""" Returns the maximum number in 'elements'. Uses 'ordered' for comparisons,
or '<' is none is provided.
"""
assert is_iterable(elements)
assert callable(ordered) or ordered is None
if not ordered: ordered = operator.lt
max = elements [0]
... | [
"def",
"max_element",
"(",
"elements",
",",
"ordered",
"=",
"None",
")",
":",
"assert",
"is_iterable",
"(",
"elements",
")",
"assert",
"callable",
"(",
"ordered",
")",
"or",
"ordered",
"is",
"None",
"if",
"not",
"ordered",
":",
"ordered",
"=",
"operator",
... | Returns the maximum number in 'elements'. Uses 'ordered' for comparisons,
or '<' is none is provided. | [
"Returns",
"the",
"maximum",
"number",
"in",
"elements",
".",
"Uses",
"ordered",
"for",
"comparisons",
"or",
"<",
"is",
"none",
"is",
"provided",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/sequence.py#L24-L37 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/util/sequence.py | select_highest_ranked | def select_highest_ranked (elements, ranks):
""" Returns all of 'elements' for which corresponding element in parallel
list 'rank' is equal to the maximum value in 'rank'.
"""
assert is_iterable(elements)
assert is_iterable(ranks)
if not elements:
return []
max_rank = max_elemen... | python | def select_highest_ranked (elements, ranks):
""" Returns all of 'elements' for which corresponding element in parallel
list 'rank' is equal to the maximum value in 'rank'.
"""
assert is_iterable(elements)
assert is_iterable(ranks)
if not elements:
return []
max_rank = max_elemen... | [
"def",
"select_highest_ranked",
"(",
"elements",
",",
"ranks",
")",
":",
"assert",
"is_iterable",
"(",
"elements",
")",
"assert",
"is_iterable",
"(",
"ranks",
")",
"if",
"not",
"elements",
":",
"return",
"[",
"]",
"max_rank",
"=",
"max_element",
"(",
"ranks"... | Returns all of 'elements' for which corresponding element in parallel
list 'rank' is equal to the maximum value in 'rank'. | [
"Returns",
"all",
"of",
"elements",
"for",
"which",
"corresponding",
"element",
"in",
"parallel",
"list",
"rank",
"is",
"equal",
"to",
"the",
"maximum",
"value",
"in",
"rank",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/sequence.py#L39-L58 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/message.py | Message.CopyFrom | def CopyFrom(self, other_msg):
"""Copies the content of the specified message into the current message.
The method clears the current message and then merges the specified
message using MergeFrom.
Args:
other_msg: Message to copy into the current one.
"""
if self is other_msg:
retu... | python | def CopyFrom(self, other_msg):
"""Copies the content of the specified message into the current message.
The method clears the current message and then merges the specified
message using MergeFrom.
Args:
other_msg: Message to copy into the current one.
"""
if self is other_msg:
retu... | [
"def",
"CopyFrom",
"(",
"self",
",",
"other_msg",
")",
":",
"if",
"self",
"is",
"other_msg",
":",
"return",
"self",
".",
"Clear",
"(",
")",
"self",
".",
"MergeFrom",
"(",
"other_msg",
")"
] | Copies the content of the specified message into the current message.
The method clears the current message and then merges the specified
message using MergeFrom.
Args:
other_msg: Message to copy into the current one. | [
"Copies",
"the",
"content",
"of",
"the",
"specified",
"message",
"into",
"the",
"current",
"message",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/message.py#L106-L118 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/xgboost/_tree_ensemble.py | recurse_json | def recurse_json(mlkit_tree, xgb_tree_json, tree_id, node_id, feature_map,
force_32bit_float):
"""Traverse through the tree and append to the tree spec.
"""
relative_hit_rate = None
try:
relative_hit_rate = xgb_tree_json['cover']
except KeyError:
pass
# Fill node attri... | python | def recurse_json(mlkit_tree, xgb_tree_json, tree_id, node_id, feature_map,
force_32bit_float):
"""Traverse through the tree and append to the tree spec.
"""
relative_hit_rate = None
try:
relative_hit_rate = xgb_tree_json['cover']
except KeyError:
pass
# Fill node attri... | [
"def",
"recurse_json",
"(",
"mlkit_tree",
",",
"xgb_tree_json",
",",
"tree_id",
",",
"node_id",
",",
"feature_map",
",",
"force_32bit_float",
")",
":",
"relative_hit_rate",
"=",
"None",
"try",
":",
"relative_hit_rate",
"=",
"xgb_tree_json",
"[",
"'cover'",
"]",
... | Traverse through the tree and append to the tree spec. | [
"Traverse",
"through",
"the",
"tree",
"and",
"append",
"to",
"the",
"tree",
"spec",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/xgboost/_tree_ensemble.py#L15-L73 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/xgboost/_tree_ensemble.py | convert_tree_ensemble | def convert_tree_ensemble(model, feature_names, target, force_32bit_float):
"""Convert a generic tree model to the protobuf spec.
This currently supports:
* Decision tree regression
Parameters
----------
model: str | Booster
Path on disk where the XGboost JSON representation of the m... | python | def convert_tree_ensemble(model, feature_names, target, force_32bit_float):
"""Convert a generic tree model to the protobuf spec.
This currently supports:
* Decision tree regression
Parameters
----------
model: str | Booster
Path on disk where the XGboost JSON representation of the m... | [
"def",
"convert_tree_ensemble",
"(",
"model",
",",
"feature_names",
",",
"target",
",",
"force_32bit_float",
")",
":",
"if",
"not",
"(",
"_HAS_XGBOOST",
")",
":",
"raise",
"RuntimeError",
"(",
"'xgboost not found. xgboost conversion API is disabled.'",
")",
"import",
... | Convert a generic tree model to the protobuf spec.
This currently supports:
* Decision tree regression
Parameters
----------
model: str | Booster
Path on disk where the XGboost JSON representation of the model is or
a handle to the XGboost model.
feature_names : list of stri... | [
"Convert",
"a",
"generic",
"tree",
"model",
"to",
"the",
"protobuf",
"spec",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/xgboost/_tree_ensemble.py#L75-L156 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_one_hot_encoder.py | convert | def convert(model, input_features, output_features):
"""Convert a one-hot-encoder model to the protobuf spec.
Parameters
----------
model: OneHotEncoder
A trained one-hot encoder model.
input_features: str, optional
Name of the input column.
output_features: str, optional
... | python | def convert(model, input_features, output_features):
"""Convert a one-hot-encoder model to the protobuf spec.
Parameters
----------
model: OneHotEncoder
A trained one-hot encoder model.
input_features: str, optional
Name of the input column.
output_features: str, optional
... | [
"def",
"convert",
"(",
"model",
",",
"input_features",
",",
"output_features",
")",
":",
"if",
"not",
"(",
"_HAS_SKLEARN",
")",
":",
"raise",
"RuntimeError",
"(",
"'scikit-learn not found. scikit-learn conversion API is disabled.'",
")",
"# Make sure the model is fitted.",
... | Convert a one-hot-encoder model to the protobuf spec.
Parameters
----------
model: OneHotEncoder
A trained one-hot encoder model.
input_features: str, optional
Name of the input column.
output_features: str, optional
Name of the output column.
Returns
-------
... | [
"Convert",
"a",
"one",
"-",
"hot",
"-",
"encoder",
"model",
"to",
"the",
"protobuf",
"spec",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_one_hot_encoder.py#L33-L189 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_one_hot_encoder.py | update_dimension | def update_dimension(model, input_dimension):
"""
Given a model that takes an array of dimension input_dimension, returns
the output dimension.
"""
if not(_HAS_SKLEARN):
raise RuntimeError('scikit-learn not found. scikit-learn conversion API is disabled.')
_sklearn_util.check_fitted(mod... | python | def update_dimension(model, input_dimension):
"""
Given a model that takes an array of dimension input_dimension, returns
the output dimension.
"""
if not(_HAS_SKLEARN):
raise RuntimeError('scikit-learn not found. scikit-learn conversion API is disabled.')
_sklearn_util.check_fitted(mod... | [
"def",
"update_dimension",
"(",
"model",
",",
"input_dimension",
")",
":",
"if",
"not",
"(",
"_HAS_SKLEARN",
")",
":",
"raise",
"RuntimeError",
"(",
"'scikit-learn not found. scikit-learn conversion API is disabled.'",
")",
"_sklearn_util",
".",
"check_fitted",
"(",
"mo... | Given a model that takes an array of dimension input_dimension, returns
the output dimension. | [
"Given",
"a",
"model",
"that",
"takes",
"an",
"array",
"of",
"dimension",
"input_dimension",
"returns",
"the",
"output",
"dimension",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_one_hot_encoder.py#L192-L209 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | convert_reshape | def convert_reshape(net, node, module, builder):
"""Converts a reshape layer from mxnet to coreml.
This doesn't currently handle the deprecated parameters for the reshape layer.
Parameters
----------
net: network
An mxnet network object.
node: layer
Node to convert.
modul... | python | def convert_reshape(net, node, module, builder):
"""Converts a reshape layer from mxnet to coreml.
This doesn't currently handle the deprecated parameters for the reshape layer.
Parameters
----------
net: network
An mxnet network object.
node: layer
Node to convert.
modul... | [
"def",
"convert_reshape",
"(",
"net",
",",
"node",
",",
"module",
",",
"builder",
")",
":",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"name",
"=",
"node",
"[",
"'name'",
"]",
"param",
"=",
"_get_attr",
... | Converts a reshape layer from mxnet to coreml.
This doesn't currently handle the deprecated parameters for the reshape layer.
Parameters
----------
net: network
An mxnet network object.
node: layer
Node to convert.
module: module
A module for MXNet
builder: Neura... | [
"Converts",
"a",
"reshape",
"layer",
"from",
"mxnet",
"to",
"coreml",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L61-L97 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | convert_elementwise_mul_scalar | def convert_elementwise_mul_scalar(net, node, module, builder):
"""Convert a scalar multiplication from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetwo... | python | def convert_elementwise_mul_scalar(net, node, module, builder):
"""Convert a scalar multiplication from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetwo... | [
"def",
"convert_elementwise_mul_scalar",
"(",
"net",
",",
"node",
",",
"module",
",",
"builder",
")",
":",
"import",
"numpy",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"name",
"=",
"node",
"[",
"'name'",
"... | Convert a scalar multiplication from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"a",
"scalar",
"multiplication",
"from",
"mxnet",
"to",
"coreml",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L224-L252 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | convert_dense | def convert_dense(net, node, module, builder):
"""Convert a dense layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neural ... | python | def convert_dense(net, node, module, builder):
"""Convert a dense layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neural ... | [
"def",
"convert_dense",
"(",
"net",
",",
"node",
",",
"module",
",",
"builder",
")",
":",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"has_bias",
"=",
"True",
"name",
"=",
"node",
"[",
"'name'",
"]",
"in... | Convert a dense layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"a",
"dense",
"layer",
"from",
"mxnet",
"to",
"coreml",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L286-L325 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | convert_padding | def convert_padding(net, node, module, builder):
"""Convert a padding layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neu... | python | def convert_padding(net, node, module, builder):
"""Convert a padding layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neu... | [
"def",
"convert_padding",
"(",
"net",
",",
"node",
",",
"module",
",",
"builder",
")",
":",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"name",
"=",
"node",
"[",
"'name'",
"]",
"param",
"=",
"_get_attr",
... | Convert a padding layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"a",
"padding",
"layer",
"from",
"mxnet",
"to",
"coreml",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L421-L462 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | convert_upsample | def convert_upsample(net, node, module, builder):
"""Convert a UpSampling layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A... | python | def convert_upsample(net, node, module, builder):
"""Convert a UpSampling layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A... | [
"def",
"convert_upsample",
"(",
"net",
",",
"node",
",",
"module",
",",
"builder",
")",
":",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"name",
"=",
"node",
"[",
"'name'",
"]",
"param",
"=",
"_get_attr",
... | Convert a UpSampling layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"a",
"UpSampling",
"layer",
"from",
"mxnet",
"to",
"coreml",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L704-L738 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | convert_softmax | def convert_softmax(net, node, module, builder):
"""Convert a softmax layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neu... | python | def convert_softmax(net, node, module, builder):
"""Convert a softmax layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neu... | [
"def",
"convert_softmax",
"(",
"net",
",",
"node",
",",
"module",
",",
"builder",
")",
":",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"name",
"=",
"node",
"[",
"'name'",
"]",
"param",
"=",
"_get_attr",
... | Convert a softmax layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
module: module
An module for MXNet
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"a",
"softmax",
"layer",
"from",
"mxnet",
"to",
"coreml",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L768-L795 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | convert_custom | def convert_custom(net, node, module, builder):
"""Convert highly specific ops"""
input_name, output_name = _get_input_output_name(net, node)
name = node['name']
param = _get_attr(node)
if param['op_type'] == 'special-darknet-maxpool':
_add_pooling.add_pooling_with_padding_types(
... | python | def convert_custom(net, node, module, builder):
"""Convert highly specific ops"""
input_name, output_name = _get_input_output_name(net, node)
name = node['name']
param = _get_attr(node)
if param['op_type'] == 'special-darknet-maxpool':
_add_pooling.add_pooling_with_padding_types(
... | [
"def",
"convert_custom",
"(",
"net",
",",
"node",
",",
"module",
",",
"builder",
")",
":",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"name",
"=",
"node",
"[",
"'name'",
"]",
"param",
"=",
"_get_attr",
... | Convert highly specific ops | [
"Convert",
"highly",
"specific",
"ops"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L808-L829 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | convert_embedding | def convert_embedding(net, node, model, builder):
"""Convert an embedding layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
A ne... | python | def convert_embedding(net, node, model, builder):
"""Convert an embedding layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
A ne... | [
"def",
"convert_embedding",
"(",
"net",
",",
"node",
",",
"model",
",",
"builder",
")",
":",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"name",
"=",
"node",
"[",
"'name'",
"]",
"inputs",
"=",
"node",
"[... | Convert an embedding layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"an",
"embedding",
"layer",
"from",
"mxnet",
"to",
"coreml",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L831-L875 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | convert_scalar_add | def convert_scalar_add(net, node, model, builder):
"""Convert a scalar add layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
A n... | python | def convert_scalar_add(net, node, model, builder):
"""Convert a scalar add layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
A n... | [
"def",
"convert_scalar_add",
"(",
"net",
",",
"node",
",",
"model",
",",
"builder",
")",
":",
"import",
"numpy",
"as",
"_np",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"name",
"=",
"node",
"[",
"'name'",... | Convert a scalar add layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"a",
"scalar",
"add",
"layer",
"from",
"mxnet",
"to",
"coreml",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L899-L923 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | convert_scalar_multiply | def convert_scalar_multiply(net, node, model, builder):
"""Convert a scalar multiply layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
... | python | def convert_scalar_multiply(net, node, model, builder):
"""Convert a scalar multiply layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
... | [
"def",
"convert_scalar_multiply",
"(",
"net",
",",
"node",
",",
"model",
",",
"builder",
")",
":",
"import",
"numpy",
"as",
"_np",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"name",
"=",
"node",
"[",
"'na... | Convert a scalar multiply layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"a",
"scalar",
"multiply",
"layer",
"from",
"mxnet",
"to",
"coreml",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L926-L949 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py | convert_instancenorm | def convert_instancenorm(net, node, model, builder):
"""Convert an instance norm layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
... | python | def convert_instancenorm(net, node, model, builder):
"""Convert an instance norm layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
... | [
"def",
"convert_instancenorm",
"(",
"net",
",",
"node",
",",
"model",
",",
"builder",
")",
":",
"import",
"numpy",
"as",
"_np",
"input_name",
",",
"output_name",
"=",
"_get_input_output_name",
"(",
"net",
",",
"node",
")",
"name",
"=",
"node",
"[",
"'name'... | Convert an instance norm layer from mxnet to coreml.
Parameters
----------
net: network
A mxnet network object.
node: layer
Node to convert.
model: model
An model for MXNet
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"an",
"instance",
"norm",
"layer",
"from",
"mxnet",
"to",
"coreml",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_to_coreml/_layers.py#L976-L1026 | train |
apple/turicreate | src/unity/python/turicreate/util/__init__.py | _get_aws_credentials | def _get_aws_credentials():
"""
Returns the values stored in the AWS credential environment variables.
Returns the value stored in the AWS_ACCESS_KEY_ID environment variable and
the value stored in the AWS_SECRET_ACCESS_KEY environment variable.
Returns
-------
out : tuple [string]
... | python | def _get_aws_credentials():
"""
Returns the values stored in the AWS credential environment variables.
Returns the value stored in the AWS_ACCESS_KEY_ID environment variable and
the value stored in the AWS_SECRET_ACCESS_KEY environment variable.
Returns
-------
out : tuple [string]
... | [
"def",
"_get_aws_credentials",
"(",
")",
":",
"if",
"(",
"not",
"'AWS_ACCESS_KEY_ID'",
"in",
"_os",
".",
"environ",
")",
":",
"raise",
"KeyError",
"(",
"'No access key found. Please set the environment variable AWS_ACCESS_KEY_ID.'",
")",
"if",
"(",
"not",
"'AWS_SECRET_A... | Returns the values stored in the AWS credential environment variables.
Returns the value stored in the AWS_ACCESS_KEY_ID environment variable and
the value stored in the AWS_SECRET_ACCESS_KEY environment variable.
Returns
-------
out : tuple [string]
The first string of the tuple is the val... | [
"Returns",
"the",
"values",
"stored",
"in",
"the",
"AWS",
"credential",
"environment",
"variables",
".",
"Returns",
"the",
"value",
"stored",
"in",
"the",
"AWS_ACCESS_KEY_ID",
"environment",
"variable",
"and",
"the",
"value",
"stored",
"in",
"the",
"AWS_SECRET_ACC... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L47-L70 | train |
apple/turicreate | src/unity/python/turicreate/util/__init__.py | _try_inject_s3_credentials | def _try_inject_s3_credentials(url):
"""
Inject aws credentials into s3 url as s3://[aws_id]:[aws_key]:[bucket/][objectkey]
If s3 url already contains secret key/id pairs, just return as is.
"""
assert url.startswith('s3://')
path = url[5:]
# Check if the path already contains credentials
... | python | def _try_inject_s3_credentials(url):
"""
Inject aws credentials into s3 url as s3://[aws_id]:[aws_key]:[bucket/][objectkey]
If s3 url already contains secret key/id pairs, just return as is.
"""
assert url.startswith('s3://')
path = url[5:]
# Check if the path already contains credentials
... | [
"def",
"_try_inject_s3_credentials",
"(",
"url",
")",
":",
"assert",
"url",
".",
"startswith",
"(",
"'s3://'",
")",
"path",
"=",
"url",
"[",
"5",
":",
"]",
"# Check if the path already contains credentials",
"tokens",
"=",
"path",
".",
"split",
"(",
"':'",
")"... | Inject aws credentials into s3 url as s3://[aws_id]:[aws_key]:[bucket/][objectkey]
If s3 url already contains secret key/id pairs, just return as is. | [
"Inject",
"aws",
"credentials",
"into",
"s3",
"url",
"as",
"s3",
":",
"//",
"[",
"aws_id",
"]",
":",
"[",
"aws_key",
"]",
":",
"[",
"bucket",
"/",
"]",
"[",
"objectkey",
"]"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L73-L92 | train |
apple/turicreate | src/unity/python/turicreate/util/__init__.py | _make_internal_url | def _make_internal_url(url):
"""
Process user input url string with proper normalization
For all urls:
Expands ~ to $HOME
For S3 urls:
Returns the s3 URL with credentials filled in using turicreate.aws.get_aws_credential().
For example: "s3://mybucket/foo" -> "s3://$AWS_ACCESS_KEY_ID:$... | python | def _make_internal_url(url):
"""
Process user input url string with proper normalization
For all urls:
Expands ~ to $HOME
For S3 urls:
Returns the s3 URL with credentials filled in using turicreate.aws.get_aws_credential().
For example: "s3://mybucket/foo" -> "s3://$AWS_ACCESS_KEY_ID:$... | [
"def",
"_make_internal_url",
"(",
"url",
")",
":",
"if",
"not",
"url",
":",
"raise",
"ValueError",
"(",
"'Invalid url: %s'",
"%",
"url",
")",
"from",
".",
".",
"import",
"_sys_util",
"from",
".",
"import",
"_file_util",
"# Convert Windows paths to Unix-style slash... | Process user input url string with proper normalization
For all urls:
Expands ~ to $HOME
For S3 urls:
Returns the s3 URL with credentials filled in using turicreate.aws.get_aws_credential().
For example: "s3://mybucket/foo" -> "s3://$AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY:mybucket/foo".
... | [
"Process",
"user",
"input",
"url",
"string",
"with",
"proper",
"normalization",
"For",
"all",
"urls",
":",
"Expands",
"~",
"to",
"$HOME",
"For",
"S3",
"urls",
":",
"Returns",
"the",
"s3",
"URL",
"with",
"credentials",
"filled",
"in",
"using",
"turicreate",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L95-L149 | train |
apple/turicreate | src/unity/python/turicreate/util/__init__.py | is_directory_archive | def is_directory_archive(path):
"""
Utility function that returns True if the path provided is a directory that has an SFrame or SGraph in it.
SFrames are written to disk as a directory archive, this function identifies if a given directory is an archive
for an SFrame.
Parameters
----------
... | python | def is_directory_archive(path):
"""
Utility function that returns True if the path provided is a directory that has an SFrame or SGraph in it.
SFrames are written to disk as a directory archive, this function identifies if a given directory is an archive
for an SFrame.
Parameters
----------
... | [
"def",
"is_directory_archive",
"(",
"path",
")",
":",
"if",
"path",
"is",
"None",
":",
"return",
"False",
"if",
"not",
"_os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"return",
"False",
"ini_path",
"=",
"'/'",
".",
"join",
"(",
"[",
"_conver... | Utility function that returns True if the path provided is a directory that has an SFrame or SGraph in it.
SFrames are written to disk as a directory archive, this function identifies if a given directory is an archive
for an SFrame.
Parameters
----------
path : string
Directory to evaluat... | [
"Utility",
"function",
"that",
"returns",
"True",
"if",
"the",
"path",
"provided",
"is",
"a",
"directory",
"that",
"has",
"an",
"SFrame",
"or",
"SGraph",
"in",
"it",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L152-L181 | train |
apple/turicreate | src/unity/python/turicreate/util/__init__.py | get_archive_type | def get_archive_type(path):
"""
Returns the contents type for the provided archive path.
Parameters
----------
path : string
Directory to evaluate.
Returns
-------
Returns a string of: sframe, sgraph, raises TypeError for anything else
"""
if not is_directory_archive(pa... | python | def get_archive_type(path):
"""
Returns the contents type for the provided archive path.
Parameters
----------
path : string
Directory to evaluate.
Returns
-------
Returns a string of: sframe, sgraph, raises TypeError for anything else
"""
if not is_directory_archive(pa... | [
"def",
"get_archive_type",
"(",
"path",
")",
":",
"if",
"not",
"is_directory_archive",
"(",
"path",
")",
":",
"raise",
"TypeError",
"(",
"'Unable to determine the type of archive at path: %s'",
"%",
"path",
")",
"try",
":",
"ini_path",
"=",
"'/'",
".",
"join",
"... | Returns the contents type for the provided archive path.
Parameters
----------
path : string
Directory to evaluate.
Returns
-------
Returns a string of: sframe, sgraph, raises TypeError for anything else | [
"Returns",
"the",
"contents",
"type",
"for",
"the",
"provided",
"archive",
"path",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L183-L207 | train |
apple/turicreate | src/unity/python/turicreate/util/__init__.py | crossproduct | def crossproduct(d):
"""
Create an SFrame containing the crossproduct of all provided options.
Parameters
----------
d : dict
Each key is the name of an option, and each value is a list
of the possible values for that option.
Returns
-------
out : SFrame
There w... | python | def crossproduct(d):
"""
Create an SFrame containing the crossproduct of all provided options.
Parameters
----------
d : dict
Each key is the name of an option, and each value is a list
of the possible values for that option.
Returns
-------
out : SFrame
There w... | [
"def",
"crossproduct",
"(",
"d",
")",
":",
"from",
".",
".",
"import",
"SArray",
"d",
"=",
"[",
"list",
"(",
"zip",
"(",
"list",
"(",
"d",
".",
"keys",
"(",
")",
")",
",",
"x",
")",
")",
"for",
"x",
"in",
"_itertools",
".",
"product",
"(",
"*... | Create an SFrame containing the crossproduct of all provided options.
Parameters
----------
d : dict
Each key is the name of an option, and each value is a list
of the possible values for that option.
Returns
-------
out : SFrame
There will be a column for each key in t... | [
"Create",
"an",
"SFrame",
"containing",
"the",
"crossproduct",
"of",
"all",
"provided",
"options",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L209-L246 | train |
apple/turicreate | src/unity/python/turicreate/util/__init__.py | get_turicreate_object_type | def get_turicreate_object_type(url):
'''
Given url where a Turi Create object is persisted, return the Turi
Create object type: 'model', 'graph', 'sframe', or 'sarray'
'''
from .._connect import main as _glconnect
ret = _glconnect.get_unity().get_turicreate_object_type(_make_internal_url(url))
... | python | def get_turicreate_object_type(url):
'''
Given url where a Turi Create object is persisted, return the Turi
Create object type: 'model', 'graph', 'sframe', or 'sarray'
'''
from .._connect import main as _glconnect
ret = _glconnect.get_unity().get_turicreate_object_type(_make_internal_url(url))
... | [
"def",
"get_turicreate_object_type",
"(",
"url",
")",
":",
"from",
".",
".",
"_connect",
"import",
"main",
"as",
"_glconnect",
"ret",
"=",
"_glconnect",
".",
"get_unity",
"(",
")",
".",
"get_turicreate_object_type",
"(",
"_make_internal_url",
"(",
"url",
")",
... | Given url where a Turi Create object is persisted, return the Turi
Create object type: 'model', 'graph', 'sframe', or 'sarray' | [
"Given",
"url",
"where",
"a",
"Turi",
"Create",
"object",
"is",
"persisted",
"return",
"the",
"Turi",
"Create",
"object",
"type",
":",
"model",
"graph",
"sframe",
"or",
"sarray"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L249-L260 | train |
apple/turicreate | src/unity/python/turicreate/util/__init__.py | _assert_sframe_equal | def _assert_sframe_equal(sf1,
sf2,
check_column_names=True,
check_column_order=True,
check_row_order=True,
float_column_delta=None):
"""
Assert the two SFrames are equal.
The default... | python | def _assert_sframe_equal(sf1,
sf2,
check_column_names=True,
check_column_order=True,
check_row_order=True,
float_column_delta=None):
"""
Assert the two SFrames are equal.
The default... | [
"def",
"_assert_sframe_equal",
"(",
"sf1",
",",
"sf2",
",",
"check_column_names",
"=",
"True",
",",
"check_column_order",
"=",
"True",
",",
"check_row_order",
"=",
"True",
",",
"float_column_delta",
"=",
"None",
")",
":",
"from",
".",
".",
"import",
"SFrame",
... | Assert the two SFrames are equal.
The default behavior of this function uses the strictest possible
definition of equality, where all columns must be in the same order, with
the same names and have the same data in the same order. Each of these
stipulations can be relaxed individually and in concert w... | [
"Assert",
"the",
"two",
"SFrames",
"are",
"equal",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L263-L365 | train |
apple/turicreate | src/unity/python/turicreate/util/__init__.py | _get_temp_file_location | def _get_temp_file_location():
'''
Returns user specified temporary file location.
The temporary location is specified through:
>>> turicreate.config.set_runtime_config('TURI_CACHE_FILE_LOCATIONS', ...)
'''
from .._connect import main as _glconnect
unity = _glconnect.get_unity()
cache_... | python | def _get_temp_file_location():
'''
Returns user specified temporary file location.
The temporary location is specified through:
>>> turicreate.config.set_runtime_config('TURI_CACHE_FILE_LOCATIONS', ...)
'''
from .._connect import main as _glconnect
unity = _glconnect.get_unity()
cache_... | [
"def",
"_get_temp_file_location",
"(",
")",
":",
"from",
".",
".",
"_connect",
"import",
"main",
"as",
"_glconnect",
"unity",
"=",
"_glconnect",
".",
"get_unity",
"(",
")",
"cache_dir",
"=",
"_convert_slashes",
"(",
"unity",
".",
"get_current_cache_file_location",... | Returns user specified temporary file location.
The temporary location is specified through:
>>> turicreate.config.set_runtime_config('TURI_CACHE_FILE_LOCATIONS', ...) | [
"Returns",
"user",
"specified",
"temporary",
"file",
"location",
".",
"The",
"temporary",
"location",
"is",
"specified",
"through",
":"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L367-L380 | train |
apple/turicreate | src/unity/python/turicreate/util/__init__.py | _make_temp_directory | def _make_temp_directory(prefix):
'''
Generate a temporary directory that would not live beyond the lifetime of
unity_server.
Caller is expected to clean up the temp file as soon as the directory is no
longer needed. But the directory will be cleaned as unity_server restarts
'''
temp_dir = ... | python | def _make_temp_directory(prefix):
'''
Generate a temporary directory that would not live beyond the lifetime of
unity_server.
Caller is expected to clean up the temp file as soon as the directory is no
longer needed. But the directory will be cleaned as unity_server restarts
'''
temp_dir = ... | [
"def",
"_make_temp_directory",
"(",
"prefix",
")",
":",
"temp_dir",
"=",
"_make_temp_filename",
"(",
"prefix",
"=",
"str",
"(",
"prefix",
")",
")",
"_os",
".",
"makedirs",
"(",
"temp_dir",
")",
"return",
"temp_dir"
] | Generate a temporary directory that would not live beyond the lifetime of
unity_server.
Caller is expected to clean up the temp file as soon as the directory is no
longer needed. But the directory will be cleaned as unity_server restarts | [
"Generate",
"a",
"temporary",
"directory",
"that",
"would",
"not",
"live",
"beyond",
"the",
"lifetime",
"of",
"unity_server",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L382-L392 | train |
apple/turicreate | src/unity/python/turicreate/util/__init__.py | _make_temp_filename | def _make_temp_filename(prefix):
'''
Generate a temporary file that would not live beyond the lifetime of
unity_server.
Caller is expected to clean up the temp file as soon as the file is no
longer needed. But temp files created using this method will be cleaned up
when unity_server restarts
... | python | def _make_temp_filename(prefix):
'''
Generate a temporary file that would not live beyond the lifetime of
unity_server.
Caller is expected to clean up the temp file as soon as the file is no
longer needed. But temp files created using this method will be cleaned up
when unity_server restarts
... | [
"def",
"_make_temp_filename",
"(",
"prefix",
")",
":",
"temp_location",
"=",
"_get_temp_file_location",
"(",
")",
"temp_file_name",
"=",
"'/'",
".",
"join",
"(",
"[",
"temp_location",
",",
"str",
"(",
"prefix",
")",
"+",
"str",
"(",
"_uuid",
".",
"uuid4",
... | Generate a temporary file that would not live beyond the lifetime of
unity_server.
Caller is expected to clean up the temp file as soon as the file is no
longer needed. But temp files created using this method will be cleaned up
when unity_server restarts | [
"Generate",
"a",
"temporary",
"file",
"that",
"would",
"not",
"live",
"beyond",
"the",
"lifetime",
"of",
"unity_server",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L394-L405 | train |
apple/turicreate | src/unity/python/turicreate/util/__init__.py | _pickle_to_temp_location_or_memory | def _pickle_to_temp_location_or_memory(obj):
'''
If obj can be serialized directly into memory (via cloudpickle) this
will return the serialized bytes.
Otherwise, gl_pickle is attempted and it will then
generates a temporary directory serializes an object into it, returning
... | python | def _pickle_to_temp_location_or_memory(obj):
'''
If obj can be serialized directly into memory (via cloudpickle) this
will return the serialized bytes.
Otherwise, gl_pickle is attempted and it will then
generates a temporary directory serializes an object into it, returning
... | [
"def",
"_pickle_to_temp_location_or_memory",
"(",
"obj",
")",
":",
"from",
".",
"import",
"_cloudpickle",
"as",
"cloudpickle",
"try",
":",
"# try cloudpickle first and see if that works",
"lambda_str",
"=",
"cloudpickle",
".",
"dumps",
"(",
"obj",
")",
"return",
"lamb... | If obj can be serialized directly into memory (via cloudpickle) this
will return the serialized bytes.
Otherwise, gl_pickle is attempted and it will then
generates a temporary directory serializes an object into it, returning
the directory name. This directory will not have lifespan grea... | [
"If",
"obj",
"can",
"be",
"serialized",
"directly",
"into",
"memory",
"(",
"via",
"cloudpickle",
")",
"this",
"will",
"return",
"the",
"serialized",
"bytes",
".",
"Otherwise",
"gl_pickle",
"is",
"attempted",
"and",
"it",
"will",
"then",
"generates",
"a",
"te... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L407-L430 | train |
apple/turicreate | src/unity/python/turicreate/util/__init__.py | _get_cuda_gpus | def _get_cuda_gpus():
"""
Returns a list of dictionaries, with the following keys:
- index (integer, device index of the GPU)
- name (str, GPU name)
- memory_free (float, free memory in MiB)
- memory_total (float, total memory in MiB)
"""
import subprocess
try:
output = subpr... | python | def _get_cuda_gpus():
"""
Returns a list of dictionaries, with the following keys:
- index (integer, device index of the GPU)
- name (str, GPU name)
- memory_free (float, free memory in MiB)
- memory_total (float, total memory in MiB)
"""
import subprocess
try:
output = subpr... | [
"def",
"_get_cuda_gpus",
"(",
")",
":",
"import",
"subprocess",
"try",
":",
"output",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"'nvidia-smi'",
",",
"'--query-gpu=index,gpu_name,memory.free,memory.total'",
",",
"'--format=csv,noheader,nounits'",
"]",
",",
"unive... | Returns a list of dictionaries, with the following keys:
- index (integer, device index of the GPU)
- name (str, GPU name)
- memory_free (float, free memory in MiB)
- memory_total (float, total memory in MiB) | [
"Returns",
"a",
"list",
"of",
"dictionaries",
"with",
"the",
"following",
"keys",
":",
"-",
"index",
"(",
"integer",
"device",
"index",
"of",
"the",
"GPU",
")",
"-",
"name",
"(",
"str",
"GPU",
"name",
")",
"-",
"memory_free",
"(",
"float",
"free",
"mem... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/__init__.py#L473-L505 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/_parameterized.py | _ParameterDecorator | def _ParameterDecorator(naming_type, testcases):
"""Implementation of the parameterization decorators.
Args:
naming_type: The naming type.
testcases: Testcase parameters.
Returns:
A function for modifying the decorated object.
"""
def _Apply(obj):
if isinstance(obj, type):
_ModifyClass... | python | def _ParameterDecorator(naming_type, testcases):
"""Implementation of the parameterization decorators.
Args:
naming_type: The naming type.
testcases: Testcase parameters.
Returns:
A function for modifying the decorated object.
"""
def _Apply(obj):
if isinstance(obj, type):
_ModifyClass... | [
"def",
"_ParameterDecorator",
"(",
"naming_type",
",",
"testcases",
")",
":",
"def",
"_Apply",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"type",
")",
":",
"_ModifyClass",
"(",
"obj",
",",
"list",
"(",
"testcases",
")",
"if",
"not",
"is... | Implementation of the parameterization decorators.
Args:
naming_type: The naming type.
testcases: Testcase parameters.
Returns:
A function for modifying the decorated object. | [
"Implementation",
"of",
"the",
"parameterization",
"decorators",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/_parameterized.py#L280-L306 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | check_header_comment | def check_header_comment(filename):
"""Checks if the header-comment of the given file needs fixing."""
# Check input file.
name = os.path.basename( filename )
# Read content of input file.
sourcefile = open( filename, "rU" )
content = sourcefile.read()
sourcefile.close()
# Search content... | python | def check_header_comment(filename):
"""Checks if the header-comment of the given file needs fixing."""
# Check input file.
name = os.path.basename( filename )
# Read content of input file.
sourcefile = open( filename, "rU" )
content = sourcefile.read()
sourcefile.close()
# Search content... | [
"def",
"check_header_comment",
"(",
"filename",
")",
":",
"# Check input file.",
"name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"filename",
")",
"# Read content of input file.",
"sourcefile",
"=",
"open",
"(",
"filename",
",",
"\"rU\"",
")",
"content",
"=... | Checks if the header-comment of the given file needs fixing. | [
"Checks",
"if",
"the",
"header",
"-",
"comment",
"of",
"the",
"given",
"file",
"needs",
"fixing",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L19-L36 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | check_input_files_for_variadic_seq | def check_input_files_for_variadic_seq(headerDir, sourceDir):
"""Checks if files, used as input when pre-processing MPL-containers in their variadic form, need fixing."""
# Check input files in include/source-directories.
files = glob.glob( os.path.join( headerDir, "*.hpp" ) )
files += glob.glob( os.pa... | python | def check_input_files_for_variadic_seq(headerDir, sourceDir):
"""Checks if files, used as input when pre-processing MPL-containers in their variadic form, need fixing."""
# Check input files in include/source-directories.
files = glob.glob( os.path.join( headerDir, "*.hpp" ) )
files += glob.glob( os.pa... | [
"def",
"check_input_files_for_variadic_seq",
"(",
"headerDir",
",",
"sourceDir",
")",
":",
"# Check input files in include/source-directories.",
"files",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"headerDir",
",",
"\"*.hpp\"",
")",
")",
"... | Checks if files, used as input when pre-processing MPL-containers in their variadic form, need fixing. | [
"Checks",
"if",
"files",
"used",
"as",
"input",
"when",
"pre",
"-",
"processing",
"MPL",
"-",
"containers",
"in",
"their",
"variadic",
"form",
"need",
"fixing",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L39-L48 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | check_input_files_for_numbered_seq | def check_input_files_for_numbered_seq(sourceDir, suffix, containers):
"""Check if files, used as input when pre-processing MPL-containers in their numbered form, need fixing."""
# Check input files for each MPL-container type.
for container in containers:
files = glob.glob( os.path.join( sourceDir,... | python | def check_input_files_for_numbered_seq(sourceDir, suffix, containers):
"""Check if files, used as input when pre-processing MPL-containers in their numbered form, need fixing."""
# Check input files for each MPL-container type.
for container in containers:
files = glob.glob( os.path.join( sourceDir,... | [
"def",
"check_input_files_for_numbered_seq",
"(",
"sourceDir",
",",
"suffix",
",",
"containers",
")",
":",
"# Check input files for each MPL-container type.",
"for",
"container",
"in",
"containers",
":",
"files",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
"."... | Check if files, used as input when pre-processing MPL-containers in their numbered form, need fixing. | [
"Check",
"if",
"files",
"used",
"as",
"input",
"when",
"pre",
"-",
"processing",
"MPL",
"-",
"containers",
"in",
"their",
"numbered",
"form",
"need",
"fixing",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L51-L59 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | check_input_files | def check_input_files(headerDir, sourceDir, containers=['vector', 'list', 'set', 'map'],
seqType='both', verbose=False):
"""Checks if source- and header-files, used as input when pre-processing MPL-containers, need fixing."""
# Check the input files for containers in their variadic form.
... | python | def check_input_files(headerDir, sourceDir, containers=['vector', 'list', 'set', 'map'],
seqType='both', verbose=False):
"""Checks if source- and header-files, used as input when pre-processing MPL-containers, need fixing."""
# Check the input files for containers in their variadic form.
... | [
"def",
"check_input_files",
"(",
"headerDir",
",",
"sourceDir",
",",
"containers",
"=",
"[",
"'vector'",
",",
"'list'",
",",
"'set'",
",",
"'map'",
"]",
",",
"seqType",
"=",
"'both'",
",",
"verbose",
"=",
"False",
")",
":",
"# Check the input files for contain... | Checks if source- and header-files, used as input when pre-processing MPL-containers, need fixing. | [
"Checks",
"if",
"source",
"-",
"and",
"header",
"-",
"files",
"used",
"as",
"input",
"when",
"pre",
"-",
"processing",
"MPL",
"-",
"containers",
"need",
"fixing",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L62-L90 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | fix_header_comment | def fix_header_comment(filename, timestamp):
"""Fixes the header-comment of the given file."""
# Fix input file.
name = os.path.basename( filename )
for line in fileinput.input( filename, inplace=1, mode="rU" ):
# If header-comment already contains anything for '$Id$', remove it.
line = ... | python | def fix_header_comment(filename, timestamp):
"""Fixes the header-comment of the given file."""
# Fix input file.
name = os.path.basename( filename )
for line in fileinput.input( filename, inplace=1, mode="rU" ):
# If header-comment already contains anything for '$Id$', remove it.
line = ... | [
"def",
"fix_header_comment",
"(",
"filename",
",",
"timestamp",
")",
":",
"# Fix input file.",
"name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"filename",
")",
"for",
"line",
"in",
"fileinput",
".",
"input",
"(",
"filename",
",",
"inplace",
"=",
"1",... | Fixes the header-comment of the given file. | [
"Fixes",
"the",
"header",
"-",
"comment",
"of",
"the",
"given",
"file",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L92-L101 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | fix_input_files_for_variadic_seq | def fix_input_files_for_variadic_seq(headerDir, sourceDir, timestamp):
"""Fixes files used as input when pre-processing MPL-containers in their variadic form."""
# Fix files in include/source-directories.
files = glob.glob( os.path.join( headerDir, "*.hpp" ) )
files += glob.glob( os.path.join( headerDi... | python | def fix_input_files_for_variadic_seq(headerDir, sourceDir, timestamp):
"""Fixes files used as input when pre-processing MPL-containers in their variadic form."""
# Fix files in include/source-directories.
files = glob.glob( os.path.join( headerDir, "*.hpp" ) )
files += glob.glob( os.path.join( headerDi... | [
"def",
"fix_input_files_for_variadic_seq",
"(",
"headerDir",
",",
"sourceDir",
",",
"timestamp",
")",
":",
"# Fix files in include/source-directories.",
"files",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"headerDir",
",",
"\"*.hpp\"",
")"... | Fixes files used as input when pre-processing MPL-containers in their variadic form. | [
"Fixes",
"files",
"used",
"as",
"input",
"when",
"pre",
"-",
"processing",
"MPL",
"-",
"containers",
"in",
"their",
"variadic",
"form",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L104-L111 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | fix_input_files_for_numbered_seq | def fix_input_files_for_numbered_seq(sourceDir, suffix, timestamp, containers):
"""Fixes files used as input when pre-processing MPL-containers in their numbered form."""
# Fix input files for each MPL-container type.
for container in containers:
files = glob.glob( os.path.join( sourceDir, container... | python | def fix_input_files_for_numbered_seq(sourceDir, suffix, timestamp, containers):
"""Fixes files used as input when pre-processing MPL-containers in their numbered form."""
# Fix input files for each MPL-container type.
for container in containers:
files = glob.glob( os.path.join( sourceDir, container... | [
"def",
"fix_input_files_for_numbered_seq",
"(",
"sourceDir",
",",
"suffix",
",",
"timestamp",
",",
"containers",
")",
":",
"# Fix input files for each MPL-container type.",
"for",
"container",
"in",
"containers",
":",
"files",
"=",
"glob",
".",
"glob",
"(",
"os",
".... | Fixes files used as input when pre-processing MPL-containers in their numbered form. | [
"Fixes",
"files",
"used",
"as",
"input",
"when",
"pre",
"-",
"processing",
"MPL",
"-",
"containers",
"in",
"their",
"numbered",
"form",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L114-L120 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | fix_input_files | def fix_input_files(headerDir, sourceDir, containers=['vector', 'list', 'set', 'map'],
seqType='both', verbose=False):
"""Fixes source- and header-files used as input when pre-processing MPL-containers."""
# The new modification time.
timestamp = datetime.datetime.now();
# Fix the in... | python | def fix_input_files(headerDir, sourceDir, containers=['vector', 'list', 'set', 'map'],
seqType='both', verbose=False):
"""Fixes source- and header-files used as input when pre-processing MPL-containers."""
# The new modification time.
timestamp = datetime.datetime.now();
# Fix the in... | [
"def",
"fix_input_files",
"(",
"headerDir",
",",
"sourceDir",
",",
"containers",
"=",
"[",
"'vector'",
",",
"'list'",
",",
"'set'",
",",
"'map'",
"]",
",",
"seqType",
"=",
"'both'",
",",
"verbose",
"=",
"False",
")",
":",
"# The new modification time.",
"tim... | Fixes source- and header-files used as input when pre-processing MPL-containers. | [
"Fixes",
"source",
"-",
"and",
"header",
"-",
"files",
"used",
"as",
"input",
"when",
"pre",
"-",
"processing",
"MPL",
"-",
"containers",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L123-L138 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | to_existing_absolute_path | def to_existing_absolute_path(string):
"""Converts a path into its absolute path and verifies that it exists or throws an exception."""
value = os.path.abspath(string)
if not os.path.exists( value ) or not os.path.isdir( value ):
msg = '"%r" is not a valid path to a directory.' % string
rais... | python | def to_existing_absolute_path(string):
"""Converts a path into its absolute path and verifies that it exists or throws an exception."""
value = os.path.abspath(string)
if not os.path.exists( value ) or not os.path.isdir( value ):
msg = '"%r" is not a valid path to a directory.' % string
rais... | [
"def",
"to_existing_absolute_path",
"(",
"string",
")",
":",
"value",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"string",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"value",
")",
"or",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"... | Converts a path into its absolute path and verifies that it exists or throws an exception. | [
"Converts",
"a",
"path",
"into",
"its",
"absolute",
"path",
"and",
"verifies",
"that",
"it",
"exists",
"or",
"throws",
"an",
"exception",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L141-L147 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | main | def main():
"""The main function."""
# Prepare and run cmdline-parser.
cmdlineParser = argparse.ArgumentParser(
description="Fixes the input files used for pre-processing of Boost.MPL headers.")
cmdlineParser.add_argument("-v", "--verbose", dest='verbose', action='store_true',
... | python | def main():
"""The main function."""
# Prepare and run cmdline-parser.
cmdlineParser = argparse.ArgumentParser(
description="Fixes the input files used for pre-processing of Boost.MPL headers.")
cmdlineParser.add_argument("-v", "--verbose", dest='verbose', action='store_true',
... | [
"def",
"main",
"(",
")",
":",
"# Prepare and run cmdline-parser.",
"cmdlineParser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"\"Fixes the input files used for pre-processing of Boost.MPL headers.\"",
")",
"cmdlineParser",
".",
"add_argument",
"(",
"\"-... | The main function. | [
"The",
"main",
"function",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L150-L201 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py | create | def create(dataset, label = None, feature = None, model = 'resnet-50', verbose = True,
batch_size = 64):
"""
Create a :class:`ImageSimilarityModel` model.
Parameters
----------
dataset : SFrame
Input data. The column named by the 'feature' parameter will be
extracted for ... | python | def create(dataset, label = None, feature = None, model = 'resnet-50', verbose = True,
batch_size = 64):
"""
Create a :class:`ImageSimilarityModel` model.
Parameters
----------
dataset : SFrame
Input data. The column named by the 'feature' parameter will be
extracted for ... | [
"def",
"create",
"(",
"dataset",
",",
"label",
"=",
"None",
",",
"feature",
"=",
"None",
",",
"model",
"=",
"'resnet-50'",
",",
"verbose",
"=",
"True",
",",
"batch_size",
"=",
"64",
")",
":",
"start_time",
"=",
"_time",
".",
"time",
"(",
")",
"# Chec... | Create a :class:`ImageSimilarityModel` model.
Parameters
----------
dataset : SFrame
Input data. The column named by the 'feature' parameter will be
extracted for modeling.
label : string
Name of the SFrame column with row labels to be used as uuid's to
identify the dat... | [
"Create",
"a",
":",
"class",
":",
"ImageSimilarityModel",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py#L27-L162 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py | ImageSimilarityModel._load_version | def _load_version(cls, state, version):
"""
A function to load a previously saved ImageClassifier
instance.
Parameters
----------
unpickler : GLUnpickler
A GLUnpickler file handler.
version : int
Version number maintained by the class wri... | python | def _load_version(cls, state, version):
"""
A function to load a previously saved ImageClassifier
instance.
Parameters
----------
unpickler : GLUnpickler
A GLUnpickler file handler.
version : int
Version number maintained by the class wri... | [
"def",
"_load_version",
"(",
"cls",
",",
"state",
",",
"version",
")",
":",
"_tkutl",
".",
"_model_version_check",
"(",
"version",
",",
"cls",
".",
"_PYTHON_IMAGE_SIMILARITY_VERSION",
")",
"from",
"turicreate",
".",
"toolkits",
".",
"nearest_neighbors",
"import",
... | A function to load a previously saved ImageClassifier
instance.
Parameters
----------
unpickler : GLUnpickler
A GLUnpickler file handler.
version : int
Version number maintained by the class writer. | [
"A",
"function",
"to",
"load",
"a",
"previously",
"saved",
"ImageClassifier",
"instance",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py#L208-L234 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py | ImageSimilarityModel.query | def query(self, dataset, label=None, k=5, radius=None, verbose=True, batch_size=64):
"""
For each image, retrieve the nearest neighbors from the model's stored
data. In general, the query dataset does not need to be the same as
the reference data stored in the model.
Parameters
... | python | def query(self, dataset, label=None, k=5, radius=None, verbose=True, batch_size=64):
"""
For each image, retrieve the nearest neighbors from the model's stored
data. In general, the query dataset does not need to be the same as
the reference data stored in the model.
Parameters
... | [
"def",
"query",
"(",
"self",
",",
"dataset",
",",
"label",
"=",
"None",
",",
"k",
"=",
"5",
",",
"radius",
"=",
"None",
",",
"verbose",
"=",
"True",
",",
"batch_size",
"=",
"64",
")",
":",
"if",
"not",
"isinstance",
"(",
"dataset",
",",
"(",
"_tc... | For each image, retrieve the nearest neighbors from the model's stored
data. In general, the query dataset does not need to be the same as
the reference data stored in the model.
Parameters
----------
dataset : SFrame | SArray | turicreate.Image
Query data.
... | [
"For",
"each",
"image",
"retrieve",
"the",
"nearest",
"neighbors",
"from",
"the",
"model",
"s",
"stored",
"data",
".",
"In",
"general",
"the",
"query",
"dataset",
"does",
"not",
"need",
"to",
"be",
"the",
"same",
"as",
"the",
"reference",
"data",
"stored",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py#L295-L381 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py | ImageSimilarityModel.similarity_graph | def similarity_graph(self, k=5, radius=None, include_self_edges=False,
output_type='SGraph', verbose=True):
"""
Construct the similarity graph on the reference dataset, which is
already stored in the model to find the top `k` similar images for each
image in your... | python | def similarity_graph(self, k=5, radius=None, include_self_edges=False,
output_type='SGraph', verbose=True):
"""
Construct the similarity graph on the reference dataset, which is
already stored in the model to find the top `k` similar images for each
image in your... | [
"def",
"similarity_graph",
"(",
"self",
",",
"k",
"=",
"5",
",",
"radius",
"=",
"None",
",",
"include_self_edges",
"=",
"False",
",",
"output_type",
"=",
"'SGraph'",
",",
"verbose",
"=",
"True",
")",
":",
"return",
"self",
".",
"similarity_model",
".",
"... | Construct the similarity graph on the reference dataset, which is
already stored in the model to find the top `k` similar images for each
image in your input dataset.
This is conceptually very similar to running `query` with the reference
set, but this method is optimized for the purpos... | [
"Construct",
"the",
"similarity",
"graph",
"on",
"the",
"reference",
"dataset",
"which",
"is",
"already",
"stored",
"in",
"the",
"model",
"to",
"find",
"the",
"top",
"k",
"similar",
"images",
"for",
"each",
"image",
"in",
"your",
"input",
"dataset",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py#L383-L456 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py | ImageSimilarityModel.export_coreml | def export_coreml(self, filename):
"""
Save the model in Core ML format.
The exported model calculates the distance between a query image and
each row of the model's stored data. It does not sort and retrieve
the k nearest neighbors of the query image.
See Also
-... | python | def export_coreml(self, filename):
"""
Save the model in Core ML format.
The exported model calculates the distance between a query image and
each row of the model's stored data. It does not sort and retrieve
the k nearest neighbors of the query image.
See Also
-... | [
"def",
"export_coreml",
"(",
"self",
",",
"filename",
")",
":",
"import",
"numpy",
"as",
"_np",
"import",
"coremltools",
"as",
"_cmt",
"from",
"coremltools",
".",
"models",
"import",
"datatypes",
"as",
"_datatypes",
",",
"neural_network",
"as",
"_neural_network"... | Save the model in Core ML format.
The exported model calculates the distance between a query image and
each row of the model's stored data. It does not sort and retrieve
the k nearest neighbors of the query image.
See Also
--------
save
Examples
--------... | [
"Save",
"the",
"model",
"in",
"Core",
"ML",
"format",
".",
"The",
"exported",
"model",
"calculates",
"the",
"distance",
"between",
"a",
"query",
"image",
"and",
"each",
"row",
"of",
"the",
"model",
"s",
"stored",
"data",
".",
"It",
"does",
"not",
"sort",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py#L458-L644 | train |
apple/turicreate | src/unity/python/turicreate/meta/asttools/visitors/graph_visitor.py | make_graph | def make_graph(node, call_deps=False):
'''
Create a dependency graph from an ast node.
:param node: ast node.
:param call_deps: if true, then the graph will create a cyclic dependence for all
function calls. (i.e for `a.b(c)` a depends on b and b depends on a)
... | python | def make_graph(node, call_deps=False):
'''
Create a dependency graph from an ast node.
:param node: ast node.
:param call_deps: if true, then the graph will create a cyclic dependence for all
function calls. (i.e for `a.b(c)` a depends on b and b depends on a)
... | [
"def",
"make_graph",
"(",
"node",
",",
"call_deps",
"=",
"False",
")",
":",
"gen",
"=",
"GraphGen",
"(",
"call_deps",
"=",
"call_deps",
")",
"gen",
".",
"visit",
"(",
"node",
")",
"return",
"gen",
".",
"graph",
",",
"gen",
".",
"undefined"
] | Create a dependency graph from an ast node.
:param node: ast node.
:param call_deps: if true, then the graph will create a cyclic dependence for all
function calls. (i.e for `a.b(c)` a depends on b and b depends on a)
:returns: a tuple of (graph, undefined) | [
"Create",
"a",
"dependency",
"graph",
"from",
"an",
"ast",
"node",
".",
":",
"param",
"node",
":",
"ast",
"node",
".",
":",
"param",
"call_deps",
":",
"if",
"true",
"then",
"the",
"graph",
"will",
"create",
"a",
"cyclic",
"dependence",
"for",
"all",
"f... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/asttools/visitors/graph_visitor.py#L393-L407 | train |
apple/turicreate | src/unity/python/turicreate/meta/bytecodetools/pyc_file.py | extract | def extract(binary):
'''
Extract a code object from a binary pyc file.
:param binary: a sequence of bytes from a pyc file.
'''
if len(binary) <= 8:
raise Exception("Binary pyc must be greater than 8 bytes (got %i)" % len(binary))
magic = binary[:4]
MAGIC = get_magic()
... | python | def extract(binary):
'''
Extract a code object from a binary pyc file.
:param binary: a sequence of bytes from a pyc file.
'''
if len(binary) <= 8:
raise Exception("Binary pyc must be greater than 8 bytes (got %i)" % len(binary))
magic = binary[:4]
MAGIC = get_magic()
... | [
"def",
"extract",
"(",
"binary",
")",
":",
"if",
"len",
"(",
"binary",
")",
"<=",
"8",
":",
"raise",
"Exception",
"(",
"\"Binary pyc must be greater than 8 bytes (got %i)\"",
"%",
"len",
"(",
"binary",
")",
")",
"magic",
"=",
"binary",
"[",
":",
"4",
"]",
... | Extract a code object from a binary pyc file.
:param binary: a sequence of bytes from a pyc file. | [
"Extract",
"a",
"code",
"object",
"from",
"a",
"binary",
"pyc",
"file",
".",
":",
"param",
"binary",
":",
"a",
"sequence",
"of",
"bytes",
"from",
"a",
"pyc",
"file",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/bytecodetools/pyc_file.py#L20-L39 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | _VarintSize | def _VarintSize(value):
"""Compute the size of a varint value."""
if value <= 0x7f: return 1
if value <= 0x3fff: return 2
if value <= 0x1fffff: return 3
if value <= 0xfffffff: return 4
if value <= 0x7ffffffff: return 5
if value <= 0x3ffffffffff: return 6
if value <= 0x1ffffffffffff: return 7
if value ... | python | def _VarintSize(value):
"""Compute the size of a varint value."""
if value <= 0x7f: return 1
if value <= 0x3fff: return 2
if value <= 0x1fffff: return 3
if value <= 0xfffffff: return 4
if value <= 0x7ffffffff: return 5
if value <= 0x3ffffffffff: return 6
if value <= 0x1ffffffffffff: return 7
if value ... | [
"def",
"_VarintSize",
"(",
"value",
")",
":",
"if",
"value",
"<=",
"0x7f",
":",
"return",
"1",
"if",
"value",
"<=",
"0x3fff",
":",
"return",
"2",
"if",
"value",
"<=",
"0x1fffff",
":",
"return",
"3",
"if",
"value",
"<=",
"0xfffffff",
":",
"return",
"4... | Compute the size of a varint value. | [
"Compute",
"the",
"size",
"of",
"a",
"varint",
"value",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L82-L93 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | _SignedVarintSize | def _SignedVarintSize(value):
"""Compute the size of a signed varint value."""
if value < 0: return 10
if value <= 0x7f: return 1
if value <= 0x3fff: return 2
if value <= 0x1fffff: return 3
if value <= 0xfffffff: return 4
if value <= 0x7ffffffff: return 5
if value <= 0x3ffffffffff: return 6
if value <... | python | def _SignedVarintSize(value):
"""Compute the size of a signed varint value."""
if value < 0: return 10
if value <= 0x7f: return 1
if value <= 0x3fff: return 2
if value <= 0x1fffff: return 3
if value <= 0xfffffff: return 4
if value <= 0x7ffffffff: return 5
if value <= 0x3ffffffffff: return 6
if value <... | [
"def",
"_SignedVarintSize",
"(",
"value",
")",
":",
"if",
"value",
"<",
"0",
":",
"return",
"10",
"if",
"value",
"<=",
"0x7f",
":",
"return",
"1",
"if",
"value",
"<=",
"0x3fff",
":",
"return",
"2",
"if",
"value",
"<=",
"0x1fffff",
":",
"return",
"3",... | Compute the size of a signed varint value. | [
"Compute",
"the",
"size",
"of",
"a",
"signed",
"varint",
"value",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L96-L108 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | _SimpleSizer | def _SimpleSizer(compute_value_size):
"""A sizer which uses the function compute_value_size to compute the size of
each value. Typically compute_value_size is _VarintSize."""
def SpecificSizer(field_number, is_repeated, is_packed):
tag_size = _TagSize(field_number)
if is_packed:
local_VarintSize =... | python | def _SimpleSizer(compute_value_size):
"""A sizer which uses the function compute_value_size to compute the size of
each value. Typically compute_value_size is _VarintSize."""
def SpecificSizer(field_number, is_repeated, is_packed):
tag_size = _TagSize(field_number)
if is_packed:
local_VarintSize =... | [
"def",
"_SimpleSizer",
"(",
"compute_value_size",
")",
":",
"def",
"SpecificSizer",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag_size",
"=",
"_TagSize",
"(",
"field_number",
")",
"if",
"is_packed",
":",
"local_VarintSize",
"=",
"_Var... | A sizer which uses the function compute_value_size to compute the size of
each value. Typically compute_value_size is _VarintSize. | [
"A",
"sizer",
"which",
"uses",
"the",
"function",
"compute_value_size",
"to",
"compute",
"the",
"size",
"of",
"each",
"value",
".",
"Typically",
"compute_value_size",
"is",
"_VarintSize",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L126-L152 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | _FixedSizer | def _FixedSizer(value_size):
"""Like _SimpleSizer except for a fixed-size field. The input is the size
of one value."""
def SpecificSizer(field_number, is_repeated, is_packed):
tag_size = _TagSize(field_number)
if is_packed:
local_VarintSize = _VarintSize
def PackedFieldSize(value):
... | python | def _FixedSizer(value_size):
"""Like _SimpleSizer except for a fixed-size field. The input is the size
of one value."""
def SpecificSizer(field_number, is_repeated, is_packed):
tag_size = _TagSize(field_number)
if is_packed:
local_VarintSize = _VarintSize
def PackedFieldSize(value):
... | [
"def",
"_FixedSizer",
"(",
"value_size",
")",
":",
"def",
"SpecificSizer",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag_size",
"=",
"_TagSize",
"(",
"field_number",
")",
"if",
"is_packed",
":",
"local_VarintSize",
"=",
"_VarintSize",... | Like _SimpleSizer except for a fixed-size field. The input is the size
of one value. | [
"Like",
"_SimpleSizer",
"except",
"for",
"a",
"fixed",
"-",
"size",
"field",
".",
"The",
"input",
"is",
"the",
"size",
"of",
"one",
"value",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L184-L207 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | BytesSizer | def BytesSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a bytes field."""
tag_size = _TagSize(field_number)
local_VarintSize = _VarintSize
local_len = len
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in va... | python | def BytesSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a bytes field."""
tag_size = _TagSize(field_number)
local_VarintSize = _VarintSize
local_len = len
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in va... | [
"def",
"BytesSizer",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag_size",
"=",
"_TagSize",
"(",
"field_number",
")",
"local_VarintSize",
"=",
"_VarintSize",
"local_len",
"=",
"len",
"assert",
"not",
"is_packed",
"if",
"is_repeated",
"... | Returns a sizer for a bytes field. | [
"Returns",
"a",
"sizer",
"for",
"a",
"bytes",
"field",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L252-L271 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | GroupSizer | def GroupSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a group field."""
tag_size = _TagSize(field_number) * 2
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in value:
result += element.ByteSize()
... | python | def GroupSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a group field."""
tag_size = _TagSize(field_number) * 2
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in value:
result += element.ByteSize()
... | [
"def",
"GroupSizer",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag_size",
"=",
"_TagSize",
"(",
"field_number",
")",
"*",
"2",
"assert",
"not",
"is_packed",
"if",
"is_repeated",
":",
"def",
"RepeatedFieldSize",
"(",
"value",
")",
... | Returns a sizer for a group field. | [
"Returns",
"a",
"sizer",
"for",
"a",
"group",
"field",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L274-L289 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | MessageSizer | def MessageSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a message field."""
tag_size = _TagSize(field_number)
local_VarintSize = _VarintSize
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in value:
l... | python | def MessageSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a message field."""
tag_size = _TagSize(field_number)
local_VarintSize = _VarintSize
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in value:
l... | [
"def",
"MessageSizer",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag_size",
"=",
"_TagSize",
"(",
"field_number",
")",
"local_VarintSize",
"=",
"_VarintSize",
"assert",
"not",
"is_packed",
"if",
"is_repeated",
":",
"def",
"RepeatedField... | Returns a sizer for a message field. | [
"Returns",
"a",
"sizer",
"for",
"a",
"message",
"field",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L292-L310 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | MessageSetItemSizer | def MessageSetItemSizer(field_number):
"""Returns a sizer for extensions of MessageSet.
The message set message looks like this:
message MessageSet {
repeated group Item = 1 {
required int32 type_id = 2;
required string message = 3;
}
}
"""
static_size = (_TagSize(1) * 2 + _... | python | def MessageSetItemSizer(field_number):
"""Returns a sizer for extensions of MessageSet.
The message set message looks like this:
message MessageSet {
repeated group Item = 1 {
required int32 type_id = 2;
required string message = 3;
}
}
"""
static_size = (_TagSize(1) * 2 + _... | [
"def",
"MessageSetItemSizer",
"(",
"field_number",
")",
":",
"static_size",
"=",
"(",
"_TagSize",
"(",
"1",
")",
"*",
"2",
"+",
"_TagSize",
"(",
"2",
")",
"+",
"_VarintSize",
"(",
"field_number",
")",
"+",
"_TagSize",
"(",
"3",
")",
")",
"local_VarintSiz... | Returns a sizer for extensions of MessageSet.
The message set message looks like this:
message MessageSet {
repeated group Item = 1 {
required int32 type_id = 2;
required string message = 3;
}
} | [
"Returns",
"a",
"sizer",
"for",
"extensions",
"of",
"MessageSet",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L317-L336 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | MapSizer | def MapSizer(field_descriptor, is_message_map):
"""Returns a sizer for a map field."""
# Can't look at field_descriptor.message_type._concrete_class because it may
# not have been initialized yet.
message_type = field_descriptor.message_type
message_sizer = MessageSizer(field_descriptor.number, False, False)... | python | def MapSizer(field_descriptor, is_message_map):
"""Returns a sizer for a map field."""
# Can't look at field_descriptor.message_type._concrete_class because it may
# not have been initialized yet.
message_type = field_descriptor.message_type
message_sizer = MessageSizer(field_descriptor.number, False, False)... | [
"def",
"MapSizer",
"(",
"field_descriptor",
",",
"is_message_map",
")",
":",
"# Can't look at field_descriptor.message_type._concrete_class because it may",
"# not have been initialized yet.",
"message_type",
"=",
"field_descriptor",
".",
"message_type",
"message_sizer",
"=",
"Mess... | Returns a sizer for a map field. | [
"Returns",
"a",
"sizer",
"for",
"a",
"map",
"field",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L343-L366 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | _VarintEncoder | def _VarintEncoder():
"""Return an encoder for a basic varint value (does not include tag)."""
def EncodeVarint(write, value):
bits = value & 0x7f
value >>= 7
while value:
write(six.int2byte(0x80|bits))
bits = value & 0x7f
value >>= 7
return write(six.int2byte(bits))
return Enc... | python | def _VarintEncoder():
"""Return an encoder for a basic varint value (does not include tag)."""
def EncodeVarint(write, value):
bits = value & 0x7f
value >>= 7
while value:
write(six.int2byte(0x80|bits))
bits = value & 0x7f
value >>= 7
return write(six.int2byte(bits))
return Enc... | [
"def",
"_VarintEncoder",
"(",
")",
":",
"def",
"EncodeVarint",
"(",
"write",
",",
"value",
")",
":",
"bits",
"=",
"value",
"&",
"0x7f",
"value",
">>=",
"7",
"while",
"value",
":",
"write",
"(",
"six",
".",
"int2byte",
"(",
"0x80",
"|",
"bits",
")",
... | Return an encoder for a basic varint value (does not include tag). | [
"Return",
"an",
"encoder",
"for",
"a",
"basic",
"varint",
"value",
"(",
"does",
"not",
"include",
"tag",
")",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L372-L384 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | _SignedVarintEncoder | def _SignedVarintEncoder():
"""Return an encoder for a basic signed varint value (does not include
tag)."""
def EncodeSignedVarint(write, value):
if value < 0:
value += (1 << 64)
bits = value & 0x7f
value >>= 7
while value:
write(six.int2byte(0x80|bits))
bits = value & 0x7f
... | python | def _SignedVarintEncoder():
"""Return an encoder for a basic signed varint value (does not include
tag)."""
def EncodeSignedVarint(write, value):
if value < 0:
value += (1 << 64)
bits = value & 0x7f
value >>= 7
while value:
write(six.int2byte(0x80|bits))
bits = value & 0x7f
... | [
"def",
"_SignedVarintEncoder",
"(",
")",
":",
"def",
"EncodeSignedVarint",
"(",
"write",
",",
"value",
")",
":",
"if",
"value",
"<",
"0",
":",
"value",
"+=",
"(",
"1",
"<<",
"64",
")",
"bits",
"=",
"value",
"&",
"0x7f",
"value",
">>=",
"7",
"while",
... | Return an encoder for a basic signed varint value (does not include
tag). | [
"Return",
"an",
"encoder",
"for",
"a",
"basic",
"signed",
"varint",
"value",
"(",
"does",
"not",
"include",
"tag",
")",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L387-L402 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | _VarintBytes | def _VarintBytes(value):
"""Encode the given integer as a varint and return the bytes. This is only
called at startup time so it doesn't need to be fast."""
pieces = []
_EncodeVarint(pieces.append, value)
return b"".join(pieces) | python | def _VarintBytes(value):
"""Encode the given integer as a varint and return the bytes. This is only
called at startup time so it doesn't need to be fast."""
pieces = []
_EncodeVarint(pieces.append, value)
return b"".join(pieces) | [
"def",
"_VarintBytes",
"(",
"value",
")",
":",
"pieces",
"=",
"[",
"]",
"_EncodeVarint",
"(",
"pieces",
".",
"append",
",",
"value",
")",
"return",
"b\"\"",
".",
"join",
"(",
"pieces",
")"
] | Encode the given integer as a varint and return the bytes. This is only
called at startup time so it doesn't need to be fast. | [
"Encode",
"the",
"given",
"integer",
"as",
"a",
"varint",
"and",
"return",
"the",
"bytes",
".",
"This",
"is",
"only",
"called",
"at",
"startup",
"time",
"so",
"it",
"doesn",
"t",
"need",
"to",
"be",
"fast",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L409-L415 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | _SimpleEncoder | def _SimpleEncoder(wire_type, encode_value, compute_value_size):
"""Return a constructor for an encoder for fields of a particular type.
Args:
wire_type: The field's wire type, for encoding tags.
encode_value: A function which encodes an individual value, e.g.
_EncodeVarint().
compute_v... | python | def _SimpleEncoder(wire_type, encode_value, compute_value_size):
"""Return a constructor for an encoder for fields of a particular type.
Args:
wire_type: The field's wire type, for encoding tags.
encode_value: A function which encodes an individual value, e.g.
_EncodeVarint().
compute_v... | [
"def",
"_SimpleEncoder",
"(",
"wire_type",
",",
"encode_value",
",",
"compute_value_size",
")",
":",
"def",
"SpecificEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"if",
"is_packed",
":",
"tag_bytes",
"=",
"TagBytes",
"(",
"field_... | Return a constructor for an encoder for fields of a particular type.
Args:
wire_type: The field's wire type, for encoding tags.
encode_value: A function which encodes an individual value, e.g.
_EncodeVarint().
compute_value_size: A function which computes the size of an individual
... | [
"Return",
"a",
"constructor",
"for",
"an",
"encoder",
"for",
"fields",
"of",
"a",
"particular",
"type",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L428-L466 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | _StructPackEncoder | def _StructPackEncoder(wire_type, format):
"""Return a constructor for an encoder for a fixed-width field.
Args:
wire_type: The field's wire type, for encoding tags.
format: The format string to pass to struct.pack().
"""
value_size = struct.calcsize(format)
def SpecificEncoder(field_number, ... | python | def _StructPackEncoder(wire_type, format):
"""Return a constructor for an encoder for a fixed-width field.
Args:
wire_type: The field's wire type, for encoding tags.
format: The format string to pass to struct.pack().
"""
value_size = struct.calcsize(format)
def SpecificEncoder(field_number, ... | [
"def",
"_StructPackEncoder",
"(",
"wire_type",
",",
"format",
")",
":",
"value_size",
"=",
"struct",
".",
"calcsize",
"(",
"format",
")",
"def",
"SpecificEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"local_struct_pack",
"=",
"... | Return a constructor for an encoder for a fixed-width field.
Args:
wire_type: The field's wire type, for encoding tags.
format: The format string to pass to struct.pack(). | [
"Return",
"a",
"constructor",
"for",
"an",
"encoder",
"for",
"a",
"fixed",
"-",
"width",
"field",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L503-L538 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | _FloatingPointEncoder | def _FloatingPointEncoder(wire_type, format):
"""Return a constructor for an encoder for float fields.
This is like StructPackEncoder, but catches errors that may be due to
passing non-finite floating-point values to struct.pack, and makes a
second attempt to encode those values.
Args:
wire_type: The... | python | def _FloatingPointEncoder(wire_type, format):
"""Return a constructor for an encoder for float fields.
This is like StructPackEncoder, but catches errors that may be due to
passing non-finite floating-point values to struct.pack, and makes a
second attempt to encode those values.
Args:
wire_type: The... | [
"def",
"_FloatingPointEncoder",
"(",
"wire_type",
",",
"format",
")",
":",
"value_size",
"=",
"struct",
".",
"calcsize",
"(",
"format",
")",
"if",
"value_size",
"==",
"4",
":",
"def",
"EncodeNonFiniteOrRaise",
"(",
"write",
",",
"value",
")",
":",
"# Remembe... | Return a constructor for an encoder for float fields.
This is like StructPackEncoder, but catches errors that may be due to
passing non-finite floating-point values to struct.pack, and makes a
second attempt to encode those values.
Args:
wire_type: The field's wire type, for encoding tags.
format... | [
"Return",
"a",
"constructor",
"for",
"an",
"encoder",
"for",
"float",
"fields",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L541-L615 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | BoolEncoder | def BoolEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a boolean field."""
false_byte = b'\x00'
true_byte = b'\x01'
if is_packed:
tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)
local_EncodeVarint = _EncodeVarint
def EncodePackedField(write, value... | python | def BoolEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a boolean field."""
false_byte = b'\x00'
true_byte = b'\x01'
if is_packed:
tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)
local_EncodeVarint = _EncodeVarint
def EncodePackedField(write, value... | [
"def",
"BoolEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"false_byte",
"=",
"b'\\x00'",
"true_byte",
"=",
"b'\\x01'",
"if",
"is_packed",
":",
"tag_bytes",
"=",
"TagBytes",
"(",
"field_number",
",",
"wire_format",
".",
"WIRETYPE_... | Returns an encoder for a boolean field. | [
"Returns",
"an",
"encoder",
"for",
"a",
"boolean",
"field",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L645-L679 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | StringEncoder | def StringEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a string field."""
tag = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)
local_EncodeVarint = _EncodeVarint
local_len = len
assert not is_packed
if is_repeated:
def EncodeRepeatedField(write, value):
... | python | def StringEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a string field."""
tag = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)
local_EncodeVarint = _EncodeVarint
local_len = len
assert not is_packed
if is_repeated:
def EncodeRepeatedField(write, value):
... | [
"def",
"StringEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag",
"=",
"TagBytes",
"(",
"field_number",
",",
"wire_format",
".",
"WIRETYPE_LENGTH_DELIMITED",
")",
"local_EncodeVarint",
"=",
"_EncodeVarint",
"local_len",
"=",
"len",
... | Returns an encoder for a string field. | [
"Returns",
"an",
"encoder",
"for",
"a",
"string",
"field",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L682-L703 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | GroupEncoder | def GroupEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a group field."""
start_tag = TagBytes(field_number, wire_format.WIRETYPE_START_GROUP)
end_tag = TagBytes(field_number, wire_format.WIRETYPE_END_GROUP)
assert not is_packed
if is_repeated:
def EncodeRepeatedField(write, val... | python | def GroupEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a group field."""
start_tag = TagBytes(field_number, wire_format.WIRETYPE_START_GROUP)
end_tag = TagBytes(field_number, wire_format.WIRETYPE_END_GROUP)
assert not is_packed
if is_repeated:
def EncodeRepeatedField(write, val... | [
"def",
"GroupEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"start_tag",
"=",
"TagBytes",
"(",
"field_number",
",",
"wire_format",
".",
"WIRETYPE_START_GROUP",
")",
"end_tag",
"=",
"TagBytes",
"(",
"field_number",
",",
"wire_format"... | Returns an encoder for a group field. | [
"Returns",
"an",
"encoder",
"for",
"a",
"group",
"field",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L728-L746 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | MessageEncoder | def MessageEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a message field."""
tag = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)
local_EncodeVarint = _EncodeVarint
assert not is_packed
if is_repeated:
def EncodeRepeatedField(write, value):
for element in v... | python | def MessageEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a message field."""
tag = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)
local_EncodeVarint = _EncodeVarint
assert not is_packed
if is_repeated:
def EncodeRepeatedField(write, value):
for element in v... | [
"def",
"MessageEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag",
"=",
"TagBytes",
"(",
"field_number",
",",
"wire_format",
".",
"WIRETYPE_LENGTH_DELIMITED",
")",
"local_EncodeVarint",
"=",
"_EncodeVarint",
"assert",
"not",
"is_pac... | Returns an encoder for a message field. | [
"Returns",
"an",
"encoder",
"for",
"a",
"message",
"field",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L749-L767 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | MessageSetItemEncoder | def MessageSetItemEncoder(field_number):
"""Encoder for extensions of MessageSet.
The message set message looks like this:
message MessageSet {
repeated group Item = 1 {
required int32 type_id = 2;
required string message = 3;
}
}
"""
start_bytes = b"".join([
TagBytes(... | python | def MessageSetItemEncoder(field_number):
"""Encoder for extensions of MessageSet.
The message set message looks like this:
message MessageSet {
repeated group Item = 1 {
required int32 type_id = 2;
required string message = 3;
}
}
"""
start_bytes = b"".join([
TagBytes(... | [
"def",
"MessageSetItemEncoder",
"(",
"field_number",
")",
":",
"start_bytes",
"=",
"b\"\"",
".",
"join",
"(",
"[",
"TagBytes",
"(",
"1",
",",
"wire_format",
".",
"WIRETYPE_START_GROUP",
")",
",",
"TagBytes",
"(",
"2",
",",
"wire_format",
".",
"WIRETYPE_VARINT"... | Encoder for extensions of MessageSet.
The message set message looks like this:
message MessageSet {
repeated group Item = 1 {
required int32 type_id = 2;
required string message = 3;
}
} | [
"Encoder",
"for",
"extensions",
"of",
"MessageSet",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L774-L799 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | MapEncoder | def MapEncoder(field_descriptor):
"""Encoder for extensions of MessageSet.
Maps always have a wire format like this:
message MapEntry {
key_type key = 1;
value_type value = 2;
}
repeated MapEntry map = N;
"""
# Can't look at field_descriptor.message_type._concrete_class because it may
... | python | def MapEncoder(field_descriptor):
"""Encoder for extensions of MessageSet.
Maps always have a wire format like this:
message MapEntry {
key_type key = 1;
value_type value = 2;
}
repeated MapEntry map = N;
"""
# Can't look at field_descriptor.message_type._concrete_class because it may
... | [
"def",
"MapEncoder",
"(",
"field_descriptor",
")",
":",
"# Can't look at field_descriptor.message_type._concrete_class because it may",
"# not have been initialized yet.",
"message_type",
"=",
"field_descriptor",
".",
"message_type",
"encode_message",
"=",
"MessageEncoder",
"(",
"f... | Encoder for extensions of MessageSet.
Maps always have a wire format like this:
message MapEntry {
key_type key = 1;
value_type value = 2;
}
repeated MapEntry map = N; | [
"Encoder",
"for",
"extensions",
"of",
"MessageSet",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L806-L826 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/caffe/_caffe_converter.py | convert | def convert(model, image_input_names=[], is_bgr=False,
red_bias=0.0, blue_bias=0.0, green_bias=0.0, gray_bias=0.0,
image_scale=1.0, class_labels=None, predicted_feature_name=None, model_precision=_MLMODEL_FULL_PRECISION):
"""
Convert a Caffe model to Core ML format.
Parameters
-... | python | def convert(model, image_input_names=[], is_bgr=False,
red_bias=0.0, blue_bias=0.0, green_bias=0.0, gray_bias=0.0,
image_scale=1.0, class_labels=None, predicted_feature_name=None, model_precision=_MLMODEL_FULL_PRECISION):
"""
Convert a Caffe model to Core ML format.
Parameters
-... | [
"def",
"convert",
"(",
"model",
",",
"image_input_names",
"=",
"[",
"]",
",",
"is_bgr",
"=",
"False",
",",
"red_bias",
"=",
"0.0",
",",
"blue_bias",
"=",
"0.0",
",",
"green_bias",
"=",
"0.0",
",",
"gray_bias",
"=",
"0.0",
",",
"image_scale",
"=",
"1.0"... | Convert a Caffe model to Core ML format.
Parameters
----------
model: str | (str, str) | (str, str, str) | (str, str, dict)
A trained Caffe neural network model which can be represented as:
- Path on disk to a trained Caffe model (.caffemodel)
- A tuple of two paths, where the fir... | [
"Convert",
"a",
"Caffe",
"model",
"to",
"Core",
"ML",
"format",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/caffe/_caffe_converter.py#L10-L197 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_svm_common.py | _set_kernel | def _set_kernel(model, spec):
"""
Takes the sklearn SVM model and returns the spec with the protobuf kernel for that model.
"""
def gamma_value(model):
if(model.gamma == 'auto'):
# auto gamma value is 1/num_features
return 1/float(len(model.support_vectors_[0]))
e... | python | def _set_kernel(model, spec):
"""
Takes the sklearn SVM model and returns the spec with the protobuf kernel for that model.
"""
def gamma_value(model):
if(model.gamma == 'auto'):
# auto gamma value is 1/num_features
return 1/float(len(model.support_vectors_[0]))
e... | [
"def",
"_set_kernel",
"(",
"model",
",",
"spec",
")",
":",
"def",
"gamma_value",
"(",
"model",
")",
":",
"if",
"(",
"model",
".",
"gamma",
"==",
"'auto'",
")",
":",
"# auto gamma value is 1/num_features",
"return",
"1",
"/",
"float",
"(",
"len",
"(",
"mo... | Takes the sklearn SVM model and returns the spec with the protobuf kernel for that model. | [
"Takes",
"the",
"sklearn",
"SVM",
"model",
"and",
"returns",
"the",
"spec",
"with",
"the",
"protobuf",
"kernel",
"for",
"that",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_svm_common.py#L11-L37 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe_builder.py | SFrameBuilder.append | def append(self, data, segment=0):
"""
Append a single row to an SFrame.
Throws a RuntimeError if one or more column's type is incompatible with
a type appended.
Parameters
----------
data : iterable
An iterable representation of a single row.
... | python | def append(self, data, segment=0):
"""
Append a single row to an SFrame.
Throws a RuntimeError if one or more column's type is incompatible with
a type appended.
Parameters
----------
data : iterable
An iterable representation of a single row.
... | [
"def",
"append",
"(",
"self",
",",
"data",
",",
"segment",
"=",
"0",
")",
":",
"# Assume this case refers to an SFrame with a single column",
"if",
"not",
"hasattr",
"(",
"data",
",",
"'__iter__'",
")",
":",
"data",
"=",
"[",
"data",
"]",
"self",
".",
"_buil... | Append a single row to an SFrame.
Throws a RuntimeError if one or more column's type is incompatible with
a type appended.
Parameters
----------
data : iterable
An iterable representation of a single row.
segment : int
The segment to write this... | [
"Append",
"a",
"single",
"row",
"to",
"an",
"SFrame",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe_builder.py#L108-L129 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe_builder.py | SFrameBuilder.append_multiple | def append_multiple(self, data, segment=0):
"""
Append multiple rows to an SFrame.
Throws a RuntimeError if one or more column's type is incompatible with
a type appended.
Parameters
----------
data : iterable[iterable]
A collection of multiple iter... | python | def append_multiple(self, data, segment=0):
"""
Append multiple rows to an SFrame.
Throws a RuntimeError if one or more column's type is incompatible with
a type appended.
Parameters
----------
data : iterable[iterable]
A collection of multiple iter... | [
"def",
"append_multiple",
"(",
"self",
",",
"data",
",",
"segment",
"=",
"0",
")",
":",
"if",
"not",
"hasattr",
"(",
"data",
",",
"'__iter__'",
")",
":",
"raise",
"TypeError",
"(",
"\"append_multiple must be passed an iterable object\"",
")",
"tmp_list",
"=",
... | Append multiple rows to an SFrame.
Throws a RuntimeError if one or more column's type is incompatible with
a type appended.
Parameters
----------
data : iterable[iterable]
A collection of multiple iterables, each representing a single row.
segment : int
... | [
"Append",
"multiple",
"rows",
"to",
"an",
"SFrame",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe_builder.py#L131-L166 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/tools/stage.py | InstallTargetClass.update_location | def update_location(self, ps):
"""If <location> is not set, sets it based on the project data."""
loc = ps.get('location')
if not loc:
loc = os.path.join(self.project().get('location'), self.name())
ps = ps.add_raw(["<location>" + loc])
return ps | python | def update_location(self, ps):
"""If <location> is not set, sets it based on the project data."""
loc = ps.get('location')
if not loc:
loc = os.path.join(self.project().get('location'), self.name())
ps = ps.add_raw(["<location>" + loc])
return ps | [
"def",
"update_location",
"(",
"self",
",",
"ps",
")",
":",
"loc",
"=",
"ps",
".",
"get",
"(",
"'location'",
")",
"if",
"not",
"loc",
":",
"loc",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"project",
"(",
")",
".",
"get",
"(",
"'loc... | If <location> is not set, sets it based on the project data. | [
"If",
"<location",
">",
"is",
"not",
"set",
"sets",
"it",
"based",
"on",
"the",
"project",
"data",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/stage.py#L41-L49 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/tools/stage.py | InstallTargetClass.targets_to_stage | def targets_to_stage(self, source_targets, ps):
"""Given the list of source targets explicitly passed to 'stage', returns the
list of targets which must be staged."""
result = []
# Traverse the dependencies, if needed.
if ps.get('install-dependencies') == ['on']:
so... | python | def targets_to_stage(self, source_targets, ps):
"""Given the list of source targets explicitly passed to 'stage', returns the
list of targets which must be staged."""
result = []
# Traverse the dependencies, if needed.
if ps.get('install-dependencies') == ['on']:
so... | [
"def",
"targets_to_stage",
"(",
"self",
",",
"source_targets",
",",
"ps",
")",
":",
"result",
"=",
"[",
"]",
"# Traverse the dependencies, if needed.",
"if",
"ps",
".",
"get",
"(",
"'install-dependencies'",
")",
"==",
"[",
"'on'",
"]",
":",
"source_targets",
"... | Given the list of source targets explicitly passed to 'stage', returns the
list of targets which must be staged. | [
"Given",
"the",
"list",
"of",
"source",
"targets",
"explicitly",
"passed",
"to",
"stage",
"returns",
"the",
"list",
"of",
"targets",
"which",
"must",
"be",
"staged",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/stage.py#L139-L166 | train |
apple/turicreate | src/unity/python/turicreate/config/__init__.py | init_logger | def init_logger():
"""
Initialize the logging configuration for the turicreate package.
This does not affect the root logging config.
"""
import logging as _logging
import logging.config
# Package level logger
_logging.config.dictConfig({
'version': 1,
'disable_existing... | python | def init_logger():
"""
Initialize the logging configuration for the turicreate package.
This does not affect the root logging config.
"""
import logging as _logging
import logging.config
# Package level logger
_logging.config.dictConfig({
'version': 1,
'disable_existing... | [
"def",
"init_logger",
"(",
")",
":",
"import",
"logging",
"as",
"_logging",
"import",
"logging",
".",
"config",
"# Package level logger",
"_logging",
".",
"config",
".",
"dictConfig",
"(",
"{",
"'version'",
":",
"1",
",",
"'disable_existing_loggers'",
":",
"Fals... | Initialize the logging configuration for the turicreate package.
This does not affect the root logging config. | [
"Initialize",
"the",
"logging",
"configuration",
"for",
"the",
"turicreate",
"package",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/config/__init__.py#L34-L81 | train |
apple/turicreate | src/unity/python/turicreate/config/__init__.py | get_environment_config | def get_environment_config():
"""
Returns all the Turi Create configuration variables that can only
be set via environment variables.
- *TURI_FILEIO_WRITER_BUFFER_SIZE*: The file write buffer size.
- *TURI_FILEIO_READER_BUFFER_SIZE*: The file read buffer size.
- *OMP_NUM_THREADS*: The maximum n... | python | def get_environment_config():
"""
Returns all the Turi Create configuration variables that can only
be set via environment variables.
- *TURI_FILEIO_WRITER_BUFFER_SIZE*: The file write buffer size.
- *TURI_FILEIO_READER_BUFFER_SIZE*: The file read buffer size.
- *OMP_NUM_THREADS*: The maximum n... | [
"def",
"get_environment_config",
"(",
")",
":",
"from",
".",
".",
"_connect",
"import",
"main",
"as",
"_glconnect",
"unity",
"=",
"_glconnect",
".",
"get_unity",
"(",
")",
"return",
"unity",
".",
"list_globals",
"(",
"False",
")"
] | Returns all the Turi Create configuration variables that can only
be set via environment variables.
- *TURI_FILEIO_WRITER_BUFFER_SIZE*: The file write buffer size.
- *TURI_FILEIO_READER_BUFFER_SIZE*: The file read buffer size.
- *OMP_NUM_THREADS*: The maximum number of threads to use for parallel proce... | [
"Returns",
"all",
"the",
"Turi",
"Create",
"configuration",
"variables",
"that",
"can",
"only",
"be",
"set",
"via",
"environment",
"variables",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/config/__init__.py#L145-L160 | train |
apple/turicreate | src/unity/python/turicreate/config/__init__.py | set_log_level | def set_log_level(level):
"""
Sets the log level.
Lower log levels log more.
if level is 8, nothing is logged. If level is 0, everything is logged.
"""
from .._connect import main as _glconnect
unity = _glconnect.get_unity()
return unity.set_log_level(level) | python | def set_log_level(level):
"""
Sets the log level.
Lower log levels log more.
if level is 8, nothing is logged. If level is 0, everything is logged.
"""
from .._connect import main as _glconnect
unity = _glconnect.get_unity()
return unity.set_log_level(level) | [
"def",
"set_log_level",
"(",
"level",
")",
":",
"from",
".",
".",
"_connect",
"import",
"main",
"as",
"_glconnect",
"unity",
"=",
"_glconnect",
".",
"get_unity",
"(",
")",
"return",
"unity",
".",
"set_log_level",
"(",
"level",
")"
] | Sets the log level.
Lower log levels log more.
if level is 8, nothing is logged. If level is 0, everything is logged. | [
"Sets",
"the",
"log",
"level",
".",
"Lower",
"log",
"levels",
"log",
"more",
".",
"if",
"level",
"is",
"8",
"nothing",
"is",
"logged",
".",
"If",
"level",
"is",
"0",
"everything",
"is",
"logged",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/config/__init__.py#L162-L170 | train |
apple/turicreate | src/unity/python/turicreate/config/__init__.py | get_runtime_config | def get_runtime_config():
"""
Returns all the Turi Create configuration variables that can be set
at runtime. See :py:func:`turicreate.config.set_runtime_config()` to set these
values and for documentation on the effect of each variable.
Returns
-------
Returns a dictionary of {key:value,..... | python | def get_runtime_config():
"""
Returns all the Turi Create configuration variables that can be set
at runtime. See :py:func:`turicreate.config.set_runtime_config()` to set these
values and for documentation on the effect of each variable.
Returns
-------
Returns a dictionary of {key:value,..... | [
"def",
"get_runtime_config",
"(",
")",
":",
"from",
".",
".",
"_connect",
"import",
"main",
"as",
"_glconnect",
"unity",
"=",
"_glconnect",
".",
"get_unity",
"(",
")",
"return",
"unity",
".",
"list_globals",
"(",
"True",
")"
] | Returns all the Turi Create configuration variables that can be set
at runtime. See :py:func:`turicreate.config.set_runtime_config()` to set these
values and for documentation on the effect of each variable.
Returns
-------
Returns a dictionary of {key:value,..}
See Also
--------
set_r... | [
"Returns",
"all",
"the",
"Turi",
"Create",
"configuration",
"variables",
"that",
"can",
"be",
"set",
"at",
"runtime",
".",
"See",
":",
"py",
":",
"func",
":",
"turicreate",
".",
"config",
".",
"set_runtime_config",
"()",
"to",
"set",
"these",
"values",
"an... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/config/__init__.py#L173-L189 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.