Skip to content

Commit

Permalink
Add typing information to functions in modules rendering/volumetric.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 383752324
  • Loading branch information
tensorflower-gardener authored and Copybara-Service committed Jul 9, 2021
1 parent 9f64815 commit c1d5ca2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
11 changes: 6 additions & 5 deletions tensorflow_graphics/rendering/volumetric/absorption.py
Expand Up @@ -21,13 +21,14 @@

from tensorflow_graphics.util import export_api
from tensorflow_graphics.util import shape
from tensorflow_graphics.util import type_alias


def render(voxels,
absorption_factor=0.1,
cell_size=1.0,
axis=2,
name="absorption_render"):
def render(voxels: type_alias.TensorLike,
absorption_factor: tf.float32 = 0.1,
cell_size: tf.float32 = 1.0,
axis: int = 2,
name: str = "absorption_render") -> tf.Tensor:
"""Renders a voxel grid using the absorption-only model, as described in ["Escaping Plato's Cave: 3D Shape From Adversarial Rendering" (Henzler 2019)](https://github.com/henzler/platonicgan).
Note:
Expand Down
11 changes: 6 additions & 5 deletions tensorflow_graphics/rendering/volumetric/emission_absorption.py
Expand Up @@ -21,13 +21,14 @@

from tensorflow_graphics.util import export_api
from tensorflow_graphics.util import shape
from tensorflow_graphics.util import type_alias


def render(voxels,
absorption_factor=0.1,
cell_size=1.0,
axis=2,
name="emission_absorption_render"):
def render(voxels: type_alias.TensorLike,
absorption_factor: tf.float32 = 0.1,
cell_size: tf.float32 = 1.0,
axis: int = 2,
name: str = "emission_absorption_render") -> tf.Tensor:
"""Renders a voxel grid using the emission-absorption model, as described in ["Escaping Plato's Cave: 3D Shape From Adversarial Rendering" (Henzler 2019)](https://github.com/henzler/platonicgan).
Note:
Expand Down
7 changes: 6 additions & 1 deletion tensorflow_graphics/rendering/volumetric/ray_radiance.py
Expand Up @@ -17,13 +17,18 @@
from __future__ import division
from __future__ import print_function

from typing import Tuple
import tensorflow as tf

from tensorflow_graphics.util import export_api
from tensorflow_graphics.util import shape
from tensorflow_graphics.util import type_alias


def compute_radiance(rgba_values, distances, name="ray_radiance"):
def compute_radiance(
rgba_values: type_alias.TensorLike,
distances: type_alias.TensorLike,
name: str = "ray_radiance") -> Tuple[tf.Tensor, tf.Tensor, tf.Tensor]:
"""Renders the rgba values for points along a ray, as described in ["NeRF Representing Scenes as Neural Radiance Fields for View Synthesis"](https://github.com/bmild/nerf).
Note:
Expand Down
5 changes: 4 additions & 1 deletion tensorflow_graphics/rendering/volumetric/visual_hull.py
Expand Up @@ -21,9 +21,12 @@

from tensorflow_graphics.util import export_api
from tensorflow_graphics.util import shape
from tensorflow_graphics.util import type_alias


def render(voxels, axis=2, name="visual_hull_render"):
def render(voxels: type_alias.TensorLike,
axis: int = 2,
name: str = "visual_hull_render") -> tf.Tensor:
"""Renders the visual hull of a voxel grid, as described in ["Escaping Plato's Cave: 3D Shape From Adversarial Rendering" (Henzler 2019)](https://github.com/henzler/platonicgan).
Note:
Expand Down

0 comments on commit c1d5ca2

Please sign in to comment.