Skip to content

Commit 2ce21d0

Browse files
Decreases random number of dimensions to a maximum of 3 to prevent huge tensors.
This fixes a bug where the test was not running with runs_per_test=2. Due to the random seed being fixed with runs_per_test=1 the numbers that were sampled were small enough by chance. With runs_per_test=2 a second set of tensor shapes was sampled which led to huge tensors that did not fit in memory. PiperOrigin-RevId: 302609726
1 parent 079af5d commit 2ce21d0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tensorflow_graphics/rendering/light/tests/point_light_test.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ def test_estimate_radiance_preset(self,
9393
the fall off of the reflected light in the calculation. Defaults to
9494
False.
9595
"""
96-
tensor_size = np.random.randint(3) + 1
97-
tensor_shape = np.random.randint(1, 10, size=(tensor_size)).tolist()
98-
lights_tensor_size = np.random.randint(3) + 1
96+
tensor_size = np.random.randint(1, 3) + 1
97+
tensor_shape = np.random.randint(1, 10, size=tensor_size).tolist()
98+
lights_tensor_size = np.random.randint(1, 3) + 1
9999
lights_tensor_shape = np.random.randint(
100-
1, 10, size=(lights_tensor_size)).tolist()
100+
1, 10, size=lights_tensor_size).tolist()
101101
point_light_radiance = np.tile(light_radiance, lights_tensor_shape + [1])
102102
point_light_position = np.tile(light_pos, lights_tensor_shape + [1])
103103
surface_point_normal = np.tile([0.0, 0.0, 1.0], tensor_shape + [1])
@@ -120,11 +120,11 @@ def test_estimate_radiance_preset(self,
120120
@flagsaver.flagsaver(tfg_add_asserts_to_graph=False)
121121
def test_estimate_radiance_jacobian_random(self):
122122
"""Tests the Jacobian of the point lighting equation."""
123-
tensor_size = np.random.randint(10)
124-
tensor_shape = np.random.randint(1, 10, size=(tensor_size)).tolist()
125-
light_tensor_size = np.random.randint(10)
123+
tensor_size = np.random.randint(1, 3)
124+
tensor_shape = np.random.randint(1, 10, size=tensor_size).tolist()
125+
light_tensor_size = np.random.randint(1, 3)
126126
lights_tensor_shape = np.random.randint(
127-
1, 10, size=(light_tensor_size)).tolist()
127+
1, 10, size=light_tensor_size).tolist()
128128
point_light_radiance_init = random_tensor(lights_tensor_shape + [1])
129129
point_light_position_init = random_tensor(lights_tensor_shape + [3])
130130
surface_point_position_init = random_tensor(tensor_shape + [3])

0 commit comments

Comments
 (0)