Showing 11,634 of 11,634 total issues
Function __init__
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def __init__(self,
vocab_size,
embedding_width=128,
hidden_size=768,
num_layers=12,
Function test_electra_pretrainer
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_electra_pretrainer(self):
"""Validate that the Keras object can be created."""
# Build a transformer network to use within the ELECTRA trainer.
vocab_size = 100
sequence_length = 512
Function __init__
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def __init__(
self,
vocab_size: int,
hidden_size: int = 768,
num_layers: int = 12,
Function test_network_invocation_with_external_logit_output
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_network_invocation_with_external_logit_output(self):
"""Validate that the logit outputs are correct."""
sequence_length = 15
input_width = 512
test_network = span_labeling.SpanLabeling(
Function test_layer_with_feedforward_cls_restoration_from_config
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_layer_with_feedforward_cls_restoration_from_config(self):
sequence_length = 21
width = 80
call_list = []
Function _token_span_mask
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def _token_span_mask(self, inputs: tf.Tensor) -> tf.Tensor:
"""Samples token spans as prediction targets."""
min_num_tokens = self._params.min_num_tokens
max_num_tokens = self._params.max_num_tokens
Function _parse_train_data
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def _parse_train_data(self, data):
"""Parses data for training.
Args:
data: the decoded tensor dictionary from TfExampleDecoder.
Function __init__
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def __init__(self, params):
super(OlnMaskModel, self).__init__(params)
self._params = params
Function main
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def main(unused_argv):
del unused_argv
strategy = distribute_utils.get_distribution_strategy(
distribution_strategy=FLAGS.strategy_type,
tpu_address=FLAGS.tpu)
Function label_anchors
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def label_anchors(
self,
anchor_boxes: Dict[str, tf.Tensor],
gt_boxes: tf.Tensor,
gt_labels: tf.Tensor,
Function __init__
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def __init__(self,
input_params: exp_cfg.DataConfig,
image_key: str = IMAGE_KEY,
label_key: str = LABEL_KEY):
self._num_frames = input_params.feature_shape[0]
Function test_build_model
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_build_model(self, include_mask, use_separable_conv,
build_anchor_boxes, use_outer_boxes, is_training):
num_classes = 3
min_level = 3
max_level = 7
Function testDetectionsOutputShape
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def testDetectionsOutputShape(
self,
nms_version,
has_att_heads,
use_cpu_nms,
Function test_layer_with_feedforward_cls_restoration_from_config
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_layer_with_feedforward_cls_restoration_from_config(self):
sequence_length = 21
width = 80
call_list = []
Function _parse_train_data
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def _parse_train_data(self, data):
"""Parses data for training.
Args:
data: the decoded tensor dictionary from TfExampleDecoder.
Function call
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def call(self, labels, predictions):
"""Comptues the OTA loss.
Args:
labels: a dictionary contains the following required keys:
Function mobilenet_edgetpu
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def mobilenet_edgetpu(image_input: tf_keras.layers.Input, config: ModelConfig): # pytype: disable=invalid-annotation # typed-keras
"""Creates a MobilenetEdgeTPU graph given the model parameters.
This function is wrapped by the `MobilenetEdgeTPU` class to make a
tf_keras.Model.
Function test_same_output
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_same_output(self):
"""Tests that OptimizedMultiHeadAttention returns the expected outputs."""
input_tensor_1 = tf.random.uniform((_BATCH_SIZE, _SEQ_LEN, _EMBEDDING_SIZE))
input_tensor_2 = tf.random.uniform((_BATCH_SIZE, _SEQ_LEN, _EMBEDDING_SIZE))
Function features_map_fn
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def features_map_fn(features, local_radius, relative_pos_max_distance,
use_hard_g2l_mask, padding_id, eos_id, null_id, cls_id,
sep_id, sequence_length, global_sequence_length):
"""Make features."""
batch_size = tf.get_static_value(features['token_ids'].shape[0])
Function test_task
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_task(self, config_name):
config = exp_factory.get_exp_config(config_name)
config.task.train_data.input_path = self._data_path
config.task.train_data.global_batch_size = 4
config.task.train_data.shuffle_buffer_size = 4