Remove use of torch.tile to fix CI

Summary: Our tests fail (https://fburl.com/jmoqo9bz) because test_splatter_blend uses torch.tile, which is not supported in earlier torch versions. Replace it with tensor.extend.

Reviewed By: bottler

Differential Revision: D36796098

fbshipit-source-id: 38d5b40667f98f3163b33f44e53e96b858cfeba2
This commit is contained in:
Krzysztof Chalupka 2022-06-01 08:47:26 -07:00 committed by Facebook GitHub Bot
parent 49ed7b07b1
commit 5b74a2cc27

View File

@ -7,7 +7,7 @@
import unittest
import torch
from common_testing import TestCaseMixin
from pytorch3d.common.compat import meshgrid_ij
from pytorch3d.renderer.cameras import FoVPerspectiveCameras
from pytorch3d.renderer.splatter_blend import (
_compute_occlusion_layers,
@ -20,6 +20,8 @@ from pytorch3d.renderer.splatter_blend import (
_prepare_pixels_and_colors,
)
from .common_testing import TestCaseMixin
offsets = torch.tensor(
[
[-1, -1],
@ -248,15 +250,13 @@ class TestComputeSplattingColorsAndWeights(TestCaseMixin, unittest.TestCase):
def setUp(self):
self.N, self.H, self.W, self.K = 2, 3, 4, 5
self.pixel_coords_screen = (
torch.tile(
torch.stack(
torch.meshgrid(
torch.arange(self.H), torch.arange(self.W), indexing="ij"
),
dim=-1,
).reshape(1, self.H, self.W, 1, 2),
(self.N, 1, 1, self.K, 1),
).float()
torch.stack(
meshgrid_ij(torch.arange(self.H), torch.arange(self.W)),
dim=-1,
)
.reshape(1, self.H, self.W, 1, 2)
.expand(self.N, self.H, self.W, self.K, 2)
.float()
+ 0.5
)
self.colors = torch.ones((self.N, self.H, self.W, self.K, 4))