-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
29 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,37 @@ | ||
from typing import Callable | ||
from typing import Callable, Generator | ||
|
||
from torch import Generator, Tensor | ||
from torch.utils.data import Dataset | ||
import torch | ||
|
||
import beignet | ||
from beignet.transforms import Transform | ||
|
||
from .__random_rotation_dataset import RandomRotationDataset | ||
|
||
class RandomQuaternionDataset(Dataset): | ||
|
||
class RandomQuaternionDataset(RandomRotationDataset): | ||
def __init__( | ||
self, | ||
size: int, | ||
canonical: bool = False, | ||
*, | ||
generator: Generator = None, | ||
device: torch.device | None = None, | ||
dtype: torch.dtype | None = None, | ||
generator: Generator | None = None, | ||
layout: torch.layout | None = torch.strided, | ||
pin_memory: bool | None = False, | ||
requires_grad: bool | None = False, | ||
transform: Callable | Transform | None = None, | ||
) -> None: | ||
super().__init__() | ||
|
||
self.size = size | ||
|
||
self.generator = generator | ||
|
||
self.transform = transform | ||
|
||
def __getitem__(self, _index: int) -> Tensor: | ||
return beignet.random_quaternion(1, generator=self.generator) | ||
|
||
def __len__(self) -> int: | ||
return self.size | ||
): | ||
super().__init__( | ||
beignet.random_quaternion( | ||
size, | ||
canonical, | ||
generator=generator, | ||
dtype=dtype, | ||
layout=layout, | ||
device=device, | ||
requires_grad=requires_grad, | ||
pin_memory=pin_memory, | ||
), | ||
transform=transform, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters