Shortcuts

SingleNumericTargetFormatter

class flash.core.data.utilities.classification.SingleNumericTargetFormatter(labels=None, num_classes=None)[source]

A TargetFormatter for targets that contain a single numeric value (the class index).

Examples

>>> import torch
>>> from flash.core.data.utilities.classification import SingleNumericTargetFormatter
>>> formatter = SingleNumericTargetFormatter(num_classes=10)
>>> formatter(5)
5
>>> formatter([5])
5
>>> formatter(torch.tensor(5))
5
Read the Docs v: latest
Versions
latest
stable
0.8.0
0.7.5
0.7.4
0.7.3
0.7.2
0.7.1
0.7.0
0.6.0
0.5.2
0.5.1
0.5.0
0.4.0
0.3.2
0.3.1
0.3.0
0.2.3
0.2.2
0.2.1
0.2.0
0.1.0post1
Downloads
html
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.