mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-02 03:42:50 +08:00
remove dataclass for python 3.6 compatibility.
Summary: Make RasterizationSettings be a NamedTuple instead of a dataclass. This makes the mesh renderer work with python 3.6. Reviewed By: nikhilaravi Differential Revision: D19769924 fbshipit-source-id: db839f3506dda7d3344fb8a101fa75bdf139ce39
This commit is contained in:
parent
3c9f06581a
commit
533887a188
@ -1,8 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
|
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
|
||||||
|
|
||||||
|
|
||||||
from dataclasses import dataclass
|
|
||||||
from typing import NamedTuple, Optional
|
from typing import NamedTuple, Optional
|
||||||
import torch
|
import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
@ -20,14 +18,31 @@ class Fragments(NamedTuple):
|
|||||||
|
|
||||||
|
|
||||||
# Class to store the mesh rasterization params with defaults
|
# Class to store the mesh rasterization params with defaults
|
||||||
@dataclass
|
|
||||||
class RasterizationSettings:
|
class RasterizationSettings:
|
||||||
image_size: int = 256
|
__slots__ = [
|
||||||
blur_radius: float = 0.0
|
"image_size",
|
||||||
faces_per_pixel: int = 1
|
"blur_radius",
|
||||||
bin_size: Optional[int] = None
|
"faces_per_pixel",
|
||||||
max_faces_per_bin: Optional[int] = None
|
"bin_size",
|
||||||
perspective_correct: bool = False
|
"max_faces_per_bin",
|
||||||
|
"perspective_correct",
|
||||||
|
]
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
image_size: int = 256,
|
||||||
|
blur_radius: float = 0.0,
|
||||||
|
faces_per_pixel: int = 1,
|
||||||
|
bin_size: Optional[int] = None,
|
||||||
|
max_faces_per_bin: Optional[int] = None,
|
||||||
|
perspective_correct: bool = False,
|
||||||
|
):
|
||||||
|
self.image_size = image_size
|
||||||
|
self.blur_radius = blur_radius
|
||||||
|
self.faces_per_pixel = faces_per_pixel
|
||||||
|
self.bin_size = bin_size
|
||||||
|
self.max_faces_per_bin = max_faces_per_bin
|
||||||
|
self.perspective_correct = perspective_correct
|
||||||
|
|
||||||
|
|
||||||
class MeshRasterizer(nn.Module):
|
class MeshRasterizer(nn.Module):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user