pytorch/test/typing/fail/creation_ops.py
Guilherme Leobas 6eeffc64f1 Port NumPy typing testing style to PyTorch (#54234)
Summary:
This is a follow-up PR of https://github.com/pytorch/pytorch/issues/52408 and includes the `pass/` and `fail/` directories.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/54234

Reviewed By: walterddr

Differential Revision: D27681410

Pulled By: malfet

fbshipit-source-id: e6817df77c758f4c1295ea62613106c71cfd3fc3
2021-04-15 01:25:16 -07:00

7 lines
299 B
Python

# flake8: noqa
import torch
torch.tensor([3], dtype='int32') # E: expected "Optional[dtype]"
torch.ones(3, dtype='int32') # E: No overload variant of "ones" matches argument types "int", "str"
torch.zeros(3, dtype='int32') # E: No overload variant of "zeros" matches argument types "int", "str"