add external files

This commit is contained in:
Shunsuke Shibayama 2024-02-11 23:04:16 +09:00
parent 7823243dbe
commit 92aa3ea078
122 changed files with 1087 additions and 0 deletions

View file

@ -0,0 +1,2 @@
.datasets = pyimport "./datasets"
.transforms = pyimport "./transforms"

View file

@ -0,0 +1,7 @@
.cifar = pyimport "./cifar"
.mnist = pyimport "./mnist"
.utils = pyimport "./utils"
.vision = pyimport "./vision"
{.CIFAR10; .CIFAR100;} = .cifar
{.MNIST; .FashionMNIST;} = .mnist

View file

@ -0,0 +1,23 @@
vision = pyimport "./vision"
.CIFAR10: ClassType
.CIFAR10 <: vision.VisionDataset
.CIFAR10.
__call__: (
root: Str,
train := Bool,
download := Bool,
transform := GenericCallable,
target_transform := GenericCallable,
) -> .CIFAR10
.CIFAR100: ClassType
.CIFAR100 <: .CIFAR10
.CIFAR100.
__call__: (
root: Str,
train := Bool,
download := Bool,
transform := GenericCallable,
target_transform := GenericCallable,
) -> .CIFAR100

View file

@ -0,0 +1,23 @@
vision = pyimport "./vision"
.MNIST: ClassType
.MNIST <: vision.VisionDataset
.MNIST.
__call__: (
root: Str,
train := Bool,
download := Bool,
transform := GenericCallable,
target_transform := GenericCallable,
) -> .MNIST
.FashionMNIST: ClassType
.FashionMNIST <: .MNIST
.FashionMNIST.
__call__: (
root: Str,
train := Bool,
download := Bool,
transform := GenericCallable,
target_transform := GenericCallable,
) -> .FashionMNIST

View file

@ -0,0 +1,15 @@
dataset = pyimport "torch/utils/data/dataset"
{Tensor!;} = pyimport "torch"
.VisionDataset: ClassType
.VisionDataset <: dataset.Dataset
.VisionDataset|<: Indexable(Nat, (Tensor!(Float, _), Tensor!(Float, _)))|.
__getitem__: (index: Nat) -> (Tensor!(Float, _), Tensor!(Float, _))
.VisionDataset.
__call__: (
root: Str,
train := Bool,
download := Bool,
transform := GenericCallable,
target_transform := GenericCallable,
) -> .VisionDataset

View file

@ -0,0 +1,3 @@
.resnet = pyimport "./resnet"
{.ResNet; .resnet18;} = .resnet

View file

@ -0,0 +1,6 @@
{.Module;} = pyimport "torch/nn"
.ResNet: ClassType
.ResNet <: .Module
.resnet18: () -> .ResNet

View file

@ -0,0 +1,11 @@
{
.Compose;
.CenterCrop;
.GrayScale;
.Normalize;
.RandomCrop;
.RandomHorizontalFlip;
.RandomResizedCrop;
.Resize;
.ToTensor;
} = pyimport "./transforms"

View file

@ -0,0 +1,69 @@
Transform: ClassType
.Compose: ClassType
.Compose <: GenericCallable
.Compose.
__call__: (transforms: [Transform; _]) -> .Compose
.CenterCrop: ClassType
.CenterCrop <: Transform
.CenterCrop <: GenericCallable
.CenterCrop.
__call__: (size: Nat or (Nat, Nat) or [Nat; 2]) -> .CenterCrop
.GrayScale: ClassType
.GrayScale <: Transform
.GrayScale <: GenericCallable
.GrayScale.
__call__: () -> .GrayScale
.Normalize: ClassType
.Normalize <: Transform
.Normalize <: GenericCallable
.Normalize.
__call__: (
mean: [Float; _],
std: [Float; _],
inplace := Bool,
) -> .Normalize
.RandomCrop: ClassType
.RandomCrop <: Transform
.RandomCrop <: GenericCallable
.RandomCrop.
__call__: (
size: Nat or (Nat, Nat) or [Nat; 2],
padding := Nat or (Nat, Nat) or (Nat, Nat, Nat, Nat),
pad_if_needed:=Bool,
fill := Nat or (Nat, Nat, Nat),
padding_mode := Str,
) -> .RandomCrop
.RandomHorizontalFlip: ClassType
.RandomHorizontalFlip <: Transform
.RandomHorizontalFlip <: GenericCallable
.RandomHorizontalFlip.
__call__: () -> .RandomHorizontalFlip
.RandomResizedCrop: ClassType
.RandomResizedCrop <: Transform
.RandomResizedCrop <: GenericCallable
.RandomResizedCrop.
__call__: (size: Nat or (Nat, Nat) or [Nat; 2]) -> .RandomResizedCrop
.Resize: ClassType
.Resize <: Transform
.Resize <: GenericCallable
.Resize.
__call__: (
size: Nat or (Nat, Nat) or [Nat; 2],
interpolation := Str,
max_size := Nat,
antialias := Bool,
) -> .Resize
.ToTensor: ClassType
.ToTensor <: Transform
.ToTensor <: GenericCallable
.ToTensor.
__call__: () -> .ToTensor