mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-19 22:00:35 +08:00
PathManager passing
Summary: Make no internal functions inside pytorch3d/io interpret str paths except using a PathManager from iopath which they have been given. This means we no longer use any global PathManager object and we no longer use fvcore's deprecated file_io. To preserve the APIs, various top level functions create their own default-initialized PathManager object if they are not provided one. Reviewed By: theschnitz Differential Revision: D25372969 fbshipit-source-id: c176ee31439645fa54a157d6f1aef18b09501569
This commit is contained in:
committed by
Facebook GitHub Bot
parent
b95621573b
commit
25c065e9da
@@ -8,6 +8,7 @@ from pathlib import Path
|
||||
|
||||
import torch
|
||||
from common_testing import TestCaseMixin
|
||||
from iopath.common.file_io import PathManager
|
||||
from pytorch3d.io import load_obj, load_objs_as_meshes, save_obj
|
||||
from pytorch3d.io.mtl_io import (
|
||||
_bilinear_interpolation_grid_sample,
|
||||
@@ -460,7 +461,9 @@ class TestMeshObjIO(TestCaseMixin, unittest.TestCase):
|
||||
]
|
||||
)
|
||||
mtl_file = StringIO(mtl_file)
|
||||
material_properties, texture_files = _parse_mtl(mtl_file, device="cpu")
|
||||
material_properties, texture_files = _parse_mtl(
|
||||
mtl_file, path_manager=PathManager(), device="cpu"
|
||||
)
|
||||
|
||||
dtype = torch.float32
|
||||
expected_materials = {
|
||||
|
||||
@@ -5,12 +5,21 @@ import unittest
|
||||
from io import BytesIO, StringIO
|
||||
from tempfile import TemporaryFile
|
||||
|
||||
import pytorch3d.io.ply_io
|
||||
import torch
|
||||
from common_testing import TestCaseMixin
|
||||
from pytorch3d.io.ply_io import _load_ply_raw, load_ply, save_ply
|
||||
from iopath.common.file_io import PathManager
|
||||
from pytorch3d.io.ply_io import load_ply, save_ply
|
||||
from pytorch3d.utils import torus
|
||||
|
||||
|
||||
global_path_manager = PathManager()
|
||||
|
||||
|
||||
def _load_ply_raw(stream):
|
||||
return pytorch3d.io.ply_io._load_ply_raw(stream, global_path_manager)
|
||||
|
||||
|
||||
class TestMeshPlyIO(TestCaseMixin, unittest.TestCase):
|
||||
def test_raw_load_simple_ascii(self):
|
||||
ply_file = "\n".join(
|
||||
|
||||
Reference in New Issue
Block a user