Код: Выделить всё
class MyDataClass:
MyData: np.ndarray | torch.float
def __init__(self, as_torch):
MyData = np.arange(1,10)
if as_torch:
MyData = torch.from_numpy(MyData)
Код: Выделить всё
TypeError: unsupported operand type(s) for |: 'type' and 'torch.dtype'
Как лучше всего это сделать? обойти эту ошибку или решить ее? Заранее спасибо!
Пробовал:
np.ndarray | факел.тензор
Подробнее здесь: https://stackoverflow.com/questions/785 ... or-a-dtype