File array_ops.py
has 5079 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Function shape_internal
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def shape_internal(input, name=None, optimize=True, out_type=None):
# pylint: disable=redefined-builtin
"""Returns the shape of a tensor.
If `out_type` is not specified and the shape is fully known, then we look at
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function size_internal
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def size_internal(input, name=None, optimize=True, out_type=dtypes.int32):
# pylint: disable=redefined-builtin,protected-access
"""Returns the size of a tensor.
Args:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function quantize_v2
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def quantize_v2(
Function quantize
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def quantize(
Function quantize_and_dequantize_v2
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def quantize_and_dequantize_v2(
Function quantize_and_dequantize
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def quantize_and_dequantize(
Function strided_slice
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def strided_slice(input_,
Function _autopacking_helper
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _autopacking_helper(list_or_tuple, dtype, name):
"""Converts the given list or tuple to a tensor by packing.
Args:
list_or_tuple: A (possibly nested) list or tuple containing a tensor.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function dequantize
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def dequantize( # pylint: disable=missing-docstring
Function extract_image_patches
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def extract_image_patches( # pylint: disable=missing-docstring
Function matrix_diag
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def matrix_diag(diagonal,
Function space_to_batch
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def space_to_batch( # pylint: disable=missing-docstring
Function one_hot
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def one_hot(indices,
Function reverse_sequence
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def reverse_sequence(input,
Function array_like_impl
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def array_like_impl(
Function gather_v2
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def gather_v2(params,
Function matrix_diag_part
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def matrix_diag_part(
Function extract_image_patches_v2
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def extract_image_patches_v2(images, sizes, strides, rates, padding, name=None):
Avoid deeply nested control flow statements. Open
if not out_type:
return constant_op._tensor_shape_tensor_conversion_function( # pylint: disable=protected-access
input_shape)
return constant(input_shape.as_list(), out_type, name=name)
Function matrix_set_diag
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def matrix_set_diag(
Function gather
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def gather(params,
Function ones_like_v2
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def ones_like_v2(
Function zeros_like_v2
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def zeros_like_v2(
Function split
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def split(value, num_or_size_splits, axis=0, num=None, name="split"):
Function pad_v2
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def pad_v2(tensor, paddings, mode="CONSTANT", constant_values=0, name=None):
Function batch_to_space
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def batch_to_space(input, crops, block_size, name=None, block_shape=None): # pylint: disable=redefined-builtin,missing-docstring
Function reverse_sequence_v2
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def reverse_sequence_v2(input,
Function pad
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def pad(tensor, paddings, mode="CONSTANT", name=None, constant_values=0): # pylint: disable=invalid-name
Function searchsorted
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def searchsorted(sorted_sequence,
Function _constant_if_small
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _constant_if_small(value, shape, dtype, name, layout=None):
Function zeros_like_impl
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def zeros_like_impl(tensor, dtype, name, optimize=True, layout=None):
Function ones_like_impl
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def ones_like_impl(tensor, dtype, name, optimize=True, layout=None):
Avoid too many return
statements within this function. Open
return gen_array_ops.size(input, name=name, out_type=out_type)