Showing 11,634 of 11,634 total issues
Function main
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def main(argv):
if len(argv) > 1:
raise RuntimeError('Too many command-line arguments.')
# Manually check if there are unknown test datasets and if the dataset
Function crop_and_threshold_masks
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def crop_and_threshold_masks(elems, input_height, input_width, mask_height=256,
mask_width=256, score_threshold=0.5,
densepose_class_index=-1):
"""Crops and thresholds masks based on detection boxes.
Function test_get_configs_from_multiple_files
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_get_configs_from_multiple_files(self):
"""Tests that proto configs can be read from multiple files."""
temp_dir = self.get_temp_dir()
# Write model config file.
Function testCheckAndParseInputConfigKey
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def testCheckAndParseInputConfigKey(self):
pipeline_config_path = os.path.join(self.get_temp_dir(), "pipeline.config")
pipeline_config = pipeline_pb2.TrainEvalPipelineConfig()
pipeline_config.eval_input_reader.add().name = "eval_1"
pipeline_config.eval_input_reader.add().name = "eval_2"
Function test_vrdrelation_evaluator
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_vrdrelation_evaluator(self):
self.vrd_eval = vrd_evaluation.VRDRelationDetectionEvaluator()
image_key1 = 'img1'
groundtruth_box_tuples1 = np.array(
Function test_vrdphrase_evaluator
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_vrdphrase_evaluator(self):
self.vrd_eval = vrd_evaluation.VRDPhraseDetectionEvaluator()
image_key1 = 'img1'
groundtruth_box_tuples1 = np.array(
Function eval_model_runs_avg_epoch
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def eval_model_runs_avg_epoch(self, data_name, data_extxd,
ext_input_extxi=None):
"""Returns all the expected value for goodies for the entire model.
The expected value is taken over hidden (z) variables, namely the initial
Function eval_model_runs_push_mean
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def eval_model_runs_push_mean(self, data_name, data_extxd,
ext_input_extxi=None):
"""Returns values of interest for the model by pushing the means through
The mean values for both initial conditions and the control inputs are
Function __init__
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def __init__(self, config, mode, **kwargs):
super(Encoder, self).__init__(**kwargs)
def _get_params(varname, default_value=None):
value = config[varname] if varname in config else default_value
Function test_network_invocation
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_network_invocation(self):
hidden_size = 32
sequence_length = 21
vocab_size = 57
num_types = 7
Function __init__
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def __init__(self,
vocab_size,
num_layers,
hidden_size,
num_attention_heads,
Function test_network_creation
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_network_creation(self, use_position_id, pack_multiple_sequences,
use_float16):
"""Validate that the Keras object can be created."""
if use_float16:
tf_keras.mixed_precision.set_global_policy('mixed_float16')
Function test_network_invocation
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_network_invocation(self, output_range, out_seq_len):
hidden_size = 32
sequence_length = 21
vocab_size = 57
num_types = 7
Function _word_span_mask
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def _word_span_mask(self, inputs: tf.Tensor, boundary: tf.Tensor):
"""Sample whole word spans as prediction targets."""
min_num_words = self._params.min_num_words
max_num_words = self._params.max_num_words
Function convert_single_example
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def convert_single_example(ex_index, example, label_list, max_seq_length,
tokenizer):
"""Converts a single `InputExample` into a single `InputFeatures`."""
label_map = {}
if label_list:
Function __init__
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def __init__(self,
output_size,
min_level,
max_level,
num_scales,
Function define_transformer_flags
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def define_transformer_flags():
"""Add flags and flag validators for running transformer_main."""
# Add common flags (data_dir, model_dir, etc.).
flags_core.define_base(num_gpu=True, distribution_strategy=True)
flags_core.define_performance(
Function __init__
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def __init__(self, flags_obj):
"""Init function of TransformerMain.
Args:
flags_obj: Object containing parsed flag values, i.e., FLAGS.
Function _compute_grid_positions
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def _compute_grid_positions(
boxes: tf.Tensor, boundaries: tf.Tensor, output_size: int,
sample_offset: float) -> Tuple[tf.Tensor, tf.Tensor, tf.Tensor, tf.Tensor]:
"""Computes the grid position w.r.t.
Function __init__
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def __init__(
self,
model_id: str = 'MobileNetV2',
filter_size_scale: float = 1.0,
input_specs: tf_keras.layers.InputSpec = layers.InputSpec(