Shortcuts

torcheval.metrics.functional.num_collisions

torcheval.metrics.functional.num_collisions(input: Tensor) Tensor[source]

Compute the number of collisions given a list of input(ids).

Parameters:input (Tensor) – a tensor of input ids (num_samples, ). class probabilities of shape (num_samples, num_classes).

Examples:

>>> import torch
>>> from torcheval.metrics.functional import num_collisions
>>> input = torch.tensor([3, 4, 2, 3])
>>> num_collisions(input)
tensor([1, 0, 0, 1])
>>> input = torch.tensor([3, 4, 1, 3, 1, 1, 5])
>>> num_collisions(input)
tensor([1, 0, 2, 1, 2, 2, 0])

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources