project_name stringlengths 6 104 | file_name stringlengths 4 89 | full_name stringlengths 1 102 | func_name stringlengths 1 85 | docstring stringlengths 13 836 | docstring_tokens listlengths 4 122 | code stringlengths 23 39.7k | code_tokens stringlengths 29 44.6k | url int64 3 986k |
|---|---|---|---|---|---|---|---|---|
sek788432/Waymo-2D-Object-Detection | binary_helper.py | write_superglue_classification | write_superglue_classification | Makes classification predictions for superglue and writes to output file. | [
"Makes",
"classification",
"predictions",
"for",
"superglue",
"and",
"writes",
"to",
"output",
"file."
] | def write_superglue_classification(task, model, input_file, output_file, predict_batch_size, seq_length, class_names, label_type='int'):
if label_type not in 'int':
raise ValueError('Unsupported `label_type`. Given: %s, expected `int` or `float`.' % label_type)
data_config = sentence_prediction_dataload... | ['def', 'write_superglue_classification(task,', 'model,', 'input_file,', 'output_file,', 'predict_batch_size,', 'seq_length,', 'class_names,', "label_type='int'):", 'if', 'label_type', 'not', 'in', "'int':", 'raise', "ValueError('Unsupported", '`label_type`.', 'Given:', '%s,', 'expected', '`int`', 'or', "`float`.'", '%... | 972,537 |
sek788432/Waymo-2D-Object-Detection | binary_helper.py | write_xtreme_classification | write_xtreme_classification | Makes classification predictions for xtreme and writes to output file. | [
"Makes",
"classification",
"predictions",
"for",
"xtreme",
"and",
"writes",
"to",
"output",
"file."
] | def write_xtreme_classification(task, model, input_file, output_file, predict_batch_size, seq_length, class_names, translated_input_file=None, test_time_aug_wgt=0.3):
data_config = sentence_prediction_dataloader.SentencePredictionDataConfig(input_path=input_file, seq_length=seq_length, is_training=False, label_type... | ['def', 'write_xtreme_classification(task,', 'model,', 'input_file,', 'output_file,', 'predict_batch_size,', 'seq_length,', 'class_names,', 'translated_input_file=None,', 'test_time_aug_wgt=0.3):', 'data_config', '=', 'sentence_prediction_dataloader.SentencePredictionDataConfig(input_path=input_file,', 'seq_length=seq_... | 972,538 |
sek788432/Waymo-2D-Object-Detection | binary_helper.py | write_question_answering | write_question_answering | Makes question answering predictions and writes to output file. | [
"Makes",
"question",
"answering",
"predictions",
"and",
"writes",
"to",
"output",
"file."
] | def write_question_answering(task, model, input_file, output_file, predict_batch_size, seq_length, tokenization, vocab_file, do_lower_case, version_2_with_negative=False):
data_config = question_answering_dataloader.QADataConfig(do_lower_case=do_lower_case, doc_stride=128, drop_remainder=False, global_batch_size=pr... | ['def', 'write_question_answering(task,', 'model,', 'input_file,', 'output_file,', 'predict_batch_size,', 'seq_length,', 'tokenization,', 'vocab_file,', 'do_lower_case,', 'version_2_with_negative=False):', 'data_config', '=', 'question_answering_dataloader.QADataConfig(do_lower_case=do_lower_case,', 'doc_stride=128,', ... | 972,539 |
sek788432/Waymo-2D-Object-Detection | binary_helper.py | write_tagging | write_tagging | Makes tagging predictions and writes to output file. | [
"Makes",
"tagging",
"predictions",
"and",
"writes",
"to",
"output",
"file."
] | def write_tagging(task, model, input_file, output_file, predict_batch_size, seq_length):
data_config = tagging_dataloader.TaggingDataConfig(input_path=input_file, is_training=False, seq_length=seq_length, global_batch_size=predict_batch_size, drop_remainder=False, include_sentence_id=True)
results = tagging.pre... | ['def', 'write_tagging(task,', 'model,', 'input_file,', 'output_file,', 'predict_batch_size,', 'seq_length):', 'data_config', '=', 'tagging_dataloader.TaggingDataConfig(input_path=input_file,', 'is_training=False,', 'seq_length=seq_length,', 'global_batch_size=predict_batch_size,', 'drop_remainder=False,', 'include_sen... | 972,540 |
sek788432/Waymo-2D-Object-Detection | transformer_encoder_block.py | TransformerEncoderBlock.call | call | Transformer self-attention encoder block call. | [
"Transformer",
"self-attention",
"encoder",
"block",
"call."
] | def call(self, inputs):
if isinstance(inputs, (list, tuple)):
if len(inputs) == 2:
(input_tensor, attention_mask) = inputs
key_value = None
elif len(inputs) == 3:
(input_tensor, key_value, attention_mask) = inputs
else:
raise ValueError('Unexpe... | ['def', 'call(self,', 'inputs):', 'if', 'isinstance(inputs,', '(list,', 'tuple)):', 'if', 'len(inputs)', '==', '2:', '(input_tensor,', 'attention_mask)', '=', 'inputs', 'key_value', '=', 'None', 'elif', 'len(inputs)', '==', '3:', '(input_tensor,', 'key_value,', 'attention_mask)', '=', 'inputs', 'else:', 'raise', "Value... | 972,545 |
sek788432/Waymo-2D-Object-Detection | cls_head.py | extract_spec_norm_kwargs | extract_spec_norm_kwargs | Extracts spectral normalization configs from a given kwarg. | [
"Extracts",
"spectral",
"normalization",
"configs",
"from",
"a",
"given",
"kwarg."
] | def extract_spec_norm_kwargs(kwargs):
return dict(iteration=kwargs.pop('iteration', 1), norm_multiplier=kwargs.pop('norm_multiplier', 0.99)) | ['def', 'extract_spec_norm_kwargs(kwargs):', 'return', "dict(iteration=kwargs.pop('iteration',", '1),', "norm_multiplier=kwargs.pop('norm_multiplier',", '0.99))'] | 972,557 |
sek788432/Waymo-2D-Object-Detection | cls_head_test.py | GaussianProcessClassificationHead.test_sngp_train_logits | test_sngp_train_logits | Checks if temperature scaling is disabled during training. | [
"Checks",
"if",
"temperature",
"scaling",
"is",
"disabled",
"during",
"training."
] | def test_sngp_train_logits(self):
features = tf.zeros(shape=(5, 10, 10), dtype=tf.float32)
gp_layer = cls_head.GaussianProcessClassificationHead(inner_dim=5, num_classes=2)
gp_layer.temperature = None
outputs_no_temp = gp_layer(features, training=True)
gp_layer.temperature = 10.0
outputs_with_te... | ['def', 'test_sngp_train_logits(self):', 'features', '=', 'tf.zeros(shape=(5,', '10,', '10),', 'dtype=tf.float32)', 'gp_layer', '=', 'cls_head.GaussianProcessClassificationHead(inner_dim=5,', 'num_classes=2)', 'gp_layer.temperature', '=', 'None', 'outputs_no_temp', '=', 'gp_layer(features,', 'training=True)', 'gp_layer... | 972,560 |
sek788432/Waymo-2D-Object-Detection | gaussian_process.py | LaplaceRandomFeatureCovariance.call | call | Minibatch updates the GP's posterior precision matrix estimate. | [
"Minibatch",
"updates",
"the",
"GP's",
"posterior",
"precision",
"matrix",
"estimate."
] | def call(self, inputs, logits=None, training=None):
batch_size = tf.shape(inputs)[0]
training = self._get_training_value(training)
if training:
precision_matrix_update_op = self.make_precision_matrix_update_op(gp_feature=inputs, logits=logits, precision_matrix=self.precision_matrix)
self.add... | ['def', 'call(self,', 'inputs,', 'logits=None,', 'training=None):', 'batch_size', '=', 'tf.shape(inputs)[0]', 'training', '=', 'self._get_training_value(training)', 'if', 'training:', 'precision_matrix_update_op', '=', 'self.make_precision_matrix_update_op(gp_feature=inputs,', 'logits=logits,', 'precision_matrix=self.p... | 972,567 |
sek788432/Waymo-2D-Object-Detection | gaussian_process_test.py | exact_gaussian_kernel | exact_gaussian_kernel | Computes exact Gaussian kernel value(s) for tensors x1 and x2. | [
"Computes",
"exact",
"Gaussian",
"kernel",
"value(s)",
"for",
"tensors",
"x1",
"and",
"x2."
] | def exact_gaussian_kernel(x1, x2):
x1_squared = tf.reduce_sum(tf.square(x1), list(range(1, len(x1.shape))))
x2_squared = tf.reduce_sum(tf.square(x2), list(range(1, len(x2.shape))))
square = x1_squared[:, tf.newaxis] + x2_squared[tf.newaxis, :] - 2 * tf.matmul(x1, x2, transpose_b=True)
return tf.math.exp... | ['def', 'exact_gaussian_kernel(x1,', 'x2):', 'x1_squared', '=', 'tf.reduce_sum(tf.square(x1),', 'list(range(1,', 'len(x1.shape))))', 'x2_squared', '=', 'tf.reduce_sum(tf.square(x2),', 'list(range(1,', 'len(x2.shape))))', 'square', '=', 'x1_squared[:,', 'tf.newaxis]', '+', 'x2_squared[tf.newaxis,', ':]', '-', '2', '*', ... | 972,568 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.