mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-02 11:52:50 +08:00
lint fixes
Summary: Ran `dev/linter.sh`. Reviewed By: bottler Differential Revision: D19761062 fbshipit-source-id: 1a49abe4a5f2bc7641b2b46e254aa77e6a48aa7d
This commit is contained in:
parent
29cd181a83
commit
97acf16de2
@ -9,7 +9,6 @@ import nbformat
|
|||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from nbconvert import HTMLExporter, ScriptExporter
|
from nbconvert import HTMLExporter, ScriptExporter
|
||||||
|
|
||||||
|
|
||||||
TEMPLATE = """const CWD = process.cwd();
|
TEMPLATE = """const CWD = process.cwd();
|
||||||
|
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
@ -43,7 +42,9 @@ def gen_tutorials(repo_dir: str) -> None:
|
|||||||
Also create ipynb and py versions of tutorial in Docusaurus site for
|
Also create ipynb and py versions of tutorial in Docusaurus site for
|
||||||
download.
|
download.
|
||||||
"""
|
"""
|
||||||
with open(os.path.join(repo_dir, "website", "tutorials.json"), "r") as infile:
|
with open(
|
||||||
|
os.path.join(repo_dir, "website", "tutorials.json"), "r"
|
||||||
|
) as infile:
|
||||||
tutorial_config = json.loads(infile.read())
|
tutorial_config = json.loads(infile.read())
|
||||||
|
|
||||||
tutorial_ids = {x["id"] for v in tutorial_config.values() for x in v}
|
tutorial_ids = {x["id"] for v in tutorial_config.values() for x in v}
|
||||||
@ -52,7 +53,9 @@ def gen_tutorials(repo_dir: str) -> None:
|
|||||||
print("Generating {} tutorial".format(tid))
|
print("Generating {} tutorial".format(tid))
|
||||||
|
|
||||||
# convert notebook to HTML
|
# convert notebook to HTML
|
||||||
ipynb_in_path = os.path.join(repo_dir, "docs", "tutorials", "{}.ipynb".format(tid))
|
ipynb_in_path = os.path.join(
|
||||||
|
repo_dir, "docs", "tutorials", "{}.ipynb".format(tid)
|
||||||
|
)
|
||||||
with open(ipynb_in_path, "r") as infile:
|
with open(ipynb_in_path, "r") as infile:
|
||||||
nb_str = infile.read()
|
nb_str = infile.read()
|
||||||
nb = nbformat.reads(nb_str, nbformat.NO_CONVERT)
|
nb = nbformat.reads(nb_str, nbformat.NO_CONVERT)
|
||||||
@ -105,7 +108,10 @@ if __name__ == "__main__":
|
|||||||
description="Generate JS, HTML, ipynb, and py files for tutorials."
|
description="Generate JS, HTML, ipynb, and py files for tutorials."
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--repo_dir", metavar="path", required=True, help="Pytorch3D repo directory."
|
"--repo_dir",
|
||||||
|
metavar="path",
|
||||||
|
required=True,
|
||||||
|
help="Pytorch3D repo directory.",
|
||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
gen_tutorials(args.repo_dir)
|
gen_tutorials(args.repo_dir)
|
@ -43,21 +43,21 @@ class TestNearestNeighborPoints(unittest.TestCase):
|
|||||||
"""
|
"""
|
||||||
Test cuda output vs naive python implementation.
|
Test cuda output vs naive python implementation.
|
||||||
"""
|
"""
|
||||||
device = torch.device('cuda:0')
|
device = torch.device("cuda:0")
|
||||||
self._test_nn_helper(device)
|
self._test_nn_helper(device)
|
||||||
|
|
||||||
def test_nn_cpu(self):
|
def test_nn_cpu(self):
|
||||||
"""
|
"""
|
||||||
Test cpu output vs naive python implementation
|
Test cpu output vs naive python implementation
|
||||||
"""
|
"""
|
||||||
device = torch.device('cpu')
|
device = torch.device("cpu")
|
||||||
self._test_nn_helper(device)
|
self._test_nn_helper(device)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def bm_nn_points_cpu_with_init(
|
def bm_nn_points_cpu_with_init(
|
||||||
N: int = 4, D: int = 4, P1: int = 128, P2: int = 128
|
N: int = 4, D: int = 4, P1: int = 128, P2: int = 128
|
||||||
):
|
):
|
||||||
device = torch.device('cpu')
|
device = torch.device("cpu")
|
||||||
x = torch.randn(N, P1, D, device=device)
|
x = torch.randn(N, P1, D, device=device)
|
||||||
y = torch.randn(N, P2, D, device=device)
|
y = torch.randn(N, P2, D, device=device)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user