Skip to content

Conversation

@wuyangzhang
Copy link

This PR intends to fix the type exceptions in common_device_type.py.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wuyangzhang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@dr-ci
Copy link

dr-ci bot commented Sep 17, 2020

💊 CI failures summary and remediations

As of commit fe49ee5 (more details on the Dr. CI page):


💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 11 times.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wuyangzhang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wuyangzhang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

mypy.ini Outdated
Comment on lines 71 to 72
#[mypy-torch.testing._internal.common_device_type.*]
#ignore_errors = True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove lines entirely.

import runpy
import threading
from functools import wraps
import typing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using from typing import Any, ... is better since you dont need to type typing.* below.

# See below for how this list is populated. If you're adding a device type
# you should check if it's available and (if it is) add it to this list.
device_type_test_bases = []
device_type_test_bases: typing.List[typing.Any] = list()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please keep my suggested change and add following comment above this line

# set type to List[Any] due to mypy list-of-union issue: https://github.com/python/mypy/issues/3351

class_name = generic_test_class.__name__ + base.device_type.upper()
device_type_test_class = type(class_name, (base, empty_class), {})

device_type_test_class: typing.Any = type(class_name, (base, empty_class), {})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep my suggested change and add the following comment above this line

# type set to Any and suppressed due to unsupport runtime class: https://github.com/python/mypy/wiki/Unsupported-Python-Features

Comment on lines 360 to 361
# Todo: Error: Argument 1 to "append" of "list" has incompatible type "Type[CUDATestBase]"; expected "Type[CPUTestBase]"
# tried to add Union to include both..
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get rid of this comment. you dont need this

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wuyangzhang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wuyangzhang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wuyangzhang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@codecov
Copy link

codecov bot commented Sep 18, 2020

Codecov Report

Merging #44911 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #44911   +/-   ##
=======================================
  Coverage   67.89%   67.89%           
=======================================
  Files         384      384           
  Lines       49890    49894    +4     
=======================================
+ Hits        33874    33878    +4     
  Misses      16016    16016           
Impacted Files Coverage Δ
torch/testing/_internal/common_device_type.py 84.94% <100.00%> (+0.16%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bee97d5...fe49ee5. Read the comment docs.

@facebook-github-bot
Copy link
Contributor

@wuyangzhang merged this pull request in d22dd80.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants