From 21aecc6e71ab5d5b5e7aea16143bd5338311bac5 Mon Sep 17 00:00:00 2001 From: Cengiz Oztireli Date: Wed, 25 Aug 2021 05:03:33 -0700 Subject: [PATCH] Adds typing information for image/color_space. PiperOrigin-RevId: 392870599 --- tensorflow_graphics/image/color_space/linear_rgb.py | 4 +++- tensorflow_graphics/image/color_space/srgb.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tensorflow_graphics/image/color_space/linear_rgb.py b/tensorflow_graphics/image/color_space/linear_rgb.py index 61b8e0272..f9524e0e7 100644 --- a/tensorflow_graphics/image/color_space/linear_rgb.py +++ b/tensorflow_graphics/image/color_space/linear_rgb.py @@ -22,6 +22,7 @@ from tensorflow_graphics.util import asserts from tensorflow_graphics.util import export_api from tensorflow_graphics.util import shape +from tensorflow_graphics.util import type_alias # Conversion constants following the naming convention from the 'theory of the # transformation' section at https://en.wikipedia.org/wiki/SRGB. @@ -31,7 +32,8 @@ _GAMMA = constants.srgb_gamma["GAMMA"] -def from_srgb(srgb, name="linear_rgb_from_srgb"): +def from_srgb(srgb: type_alias.TensorLike, + name: str = "linear_rgb_from_srgb") -> tf.Tensor: """Converts sRGB colors to linear colors. Note: diff --git a/tensorflow_graphics/image/color_space/srgb.py b/tensorflow_graphics/image/color_space/srgb.py index f65cdb4e1..8c5552edf 100644 --- a/tensorflow_graphics/image/color_space/srgb.py +++ b/tensorflow_graphics/image/color_space/srgb.py @@ -28,6 +28,7 @@ from tensorflow_graphics.util import asserts from tensorflow_graphics.util import export_api from tensorflow_graphics.util import shape +from tensorflow_graphics.util import type_alias # Conversion constants following the naming convention from the 'theory of the # transformation' section at https://en.wikipedia.org/wiki/SRGB. @@ -37,7 +38,8 @@ _GAMMA = constants.srgb_gamma["GAMMA"] -def from_linear_rgb(linear_rgb, name="srgb_from_linear_rgb"): +def from_linear_rgb(linear_rgb: type_alias.TensorLike, + name: str = "srgb_from_linear_rgb") -> tf.Tensor: """Converts linear RGB to sRGB colors. Note: