deeplabcut.pose_estimation_pytorch.models.criterions.utils
Functions:
| Name | Description |
|---|---|
count_nonzero_elems |
Compute the number of elements in the loss function induced by |
count_nonzero_elems
Compute the number of elements in the loss function induced by weights.
This is a torch implementation of https://github.com/tensorflow/tensorflow/blob/4dacf3f368eb7965e9b5c3bbdd5193986081c3b2/tensorflow/python/ops/losses/losses_impl.py#L89
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Tensor
|
Tensor of shape [batch_size, d1, ... dN]. |
required |
|
Tensor
|
Tensor of shape [], [batch_size] or [batch_size, d1, ... dK], where K < N. |
required |
|
bool
|
Whether to return the number of elements per batch or as a sum total. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
Tensor |
The number of present (non-zero) elements in the losses tensor. |