Shortcuts

StringToInt

class torcheeg.transforms.StringToInt[source][source]

Identify numbers in strings and convert strings to numbers. If there is no number in the string, the output corresponding to the string is 0.

from torcheeg import transforms

t = transforms.StringToInt()
t(y='None')['y']
>>> 0

t = transforms.StringToInt()
t(y='sub001')['y']
>>> 1

StringToInt allows converting a list of strings to a list of numbers with the same conversion behavior as a single string.

t = transforms.StringToInt()
t(y=['sub001', '4'])['y']
>>> 1, 4
__call__(*args, y: str | List[str], **kwargs) int | List[int][source][source]
Parameters:

label (str) – The input label or list of labels.

Returns:

The output label or list of labels after binarization.

Return type:

int

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