Showing 95 of 134 total issues
Function recursive_apply
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def recursive_apply(data: Any, tensor_fn: Callable, other_fn: Callable | None = None) -> Any:
r"""Recursively applies a function on all the ``torch.Tensor``s.
The current implementation supports the following types:
- 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 move_to_device
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def move_to_device(data: T, device: torch.device) -> T:
r"""Moves an object to a given device.
If the object is a nested object (e.g. list, tuple, dictionary,
set), this function sends the elements to the device. The current
- 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 __iter__
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __iter__(self) -> Iterator[T]:
step = 0
while step < self._length:
for data in self._datapipe:
yield data
- 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 shuffle_tensor_mapping
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def shuffle_tensor_mapping(
mapping: Mapping, dim: int | dict = 0, generator: torch.Generator | None = None
) -> dict:
r"""Shuffles the tensors that are in a mapping with the same
permutation.
- 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 __iter__
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __iter__(self) -> Iterator[dict]:
datapipe_or_data = self._datapipe_or_data
if not isinstance(datapipe_or_data, IterDataPipe):
datapipe_or_data = SourceWrapperIterDataPipe([datapipe_or_data])
for batch in datapipe_or_data:
- 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 log_optimizer_parameters_per_group
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def log_optimizer_parameters_per_group(
optimizer: Optimizer,
engine: BaseEngine,
step: Step | None = None,
prefix: str = "",
- 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 create_chained_datapipe
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_chained_datapipe(
config: dict | Sequence[dict],
source_inputs: Sequence | None = None,
) -> IterDataPipe[T] | MapDataPipe[T]:
r"""Creates a chained ``DataPipe`` object.
- 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 sync_reduce_
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sync_reduce_(tensor: Tensor, op: str) -> Tensor:
r"""In-place version of ``sync_reduce`` but it works only for 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 __str__
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __str__(self) -> str:
count = self.count
stats = str_pretty_dict(
{
"average": self.average() if count else "N/A (empty)",
- 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 train
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def train(self) -> None:
with timeblock("=== Training time: {time} ==="):
logger.info("Launching training procedures")
self.trigger_event(EngineEvents.STARTED)
self.trigger_event(EngineEvents.TRAIN_STARTED)
- 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 equal
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def equal(
self,
tester: BaseEqualityTester,
object1: ExampleDataset,
object2: Any,
- 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 get_best_values
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_best_values(
histories: Mapping[str, BaseHistory], prefix: str = "", suffix: str = ""
) -> dict[str, Any]:
"""Gets the best value of each history.
- 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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update(self, data: dict) -> None:
r"""Tracks the values that can be convert in int or float.
The values that cannot be convert in int or float are ignored.
Similarly, the NaN are ignored.
- 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 _check
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _check(self) -> None:
# Verify each data loader creator has a dataset
for key in self._dataloader_creators:
if key not in self._datasets:
logger.warning(f"Missing '{key}' dataset for its associated data loader creator")
- 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 show_optimizer_parameters_per_group
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def show_optimizer_parameters_per_group(optimizer: Optimizer, tablefmt: str = "fancy_grid") -> None:
r"""Shows the optimizer parameters for each group.
This function uses the ``tabulate`` package to log the results in
a table.
- 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"