Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dataloader] type annotation is broken #22135

Closed
ssnl opened this issue Jun 24, 2019 · 2 comments
Closed

[dataloader] type annotation is broken #22135

ssnl opened this issue Jun 24, 2019 · 2 comments
Labels
module: dataloader Related to torch.utils.data.DataLoader and Sampler module: typing Related to mypy type annotations triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@ssnl
Copy link
Collaborator

ssnl commented Jun 24, 2019

In #19228 I did not update the type annotations. We should fix this.

@VitalyFedyunin VitalyFedyunin added module: dataloader Related to torch.utils.data.DataLoader and Sampler module: typing Related to mypy type annotations triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module labels Jun 24, 2019
@utikeev
Copy link

utikeev commented Aug 2, 2019

I've also found that bunch of optional parameters are not labeled with Optional:
dataloader.pyi:

def __init__(self, dataset: Dataset[T_co], batch_size: int=..., shuffle: bool=..., sampler: Sampler[int]=...,
                 num_workers: int=..., collate_fn: _collate_fn_t=..., pin_memory: bool=...,
                 drop_last: bool=..., timeout: float=..., worker_init_fn: _worker_init_fn_t=...) -> None: ...

def __init__(self, dataset: Dataset[T_co], batch_sampler: Sampler[Sequence[int]]=..., num_workers: int=...,
                 collate_fn: _collate_fn_t=..., pin_memory: bool=..., timeout: float=...,
                 worker_init_fn: _worker_init_fn_t=...) -> None: ...

dataloader.py:

def __init__(self, dataset, batch_size=1, shuffle=False, sampler=None,
                 batch_sampler=None, num_workers=0, collate_fn=default_collate,
                 pin_memory=False, drop_last=False, timeout=0,
                 worker_init_fn=None):

So these are sampler, batch_sampler and worker_init_fn.

@ssnl
Copy link
Collaborator Author

ssnl commented Nov 1, 2019

I think this is fixed by a couple recent PRs

@ssnl ssnl closed this as completed Nov 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: dataloader Related to torch.utils.data.DataLoader and Sampler module: typing Related to mypy type annotations triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests

3 participants