Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tensorflow_graphics/datasets/modelnet40/modelnet40.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ def _split_generators(self, download_manager):
# Note: VALIDATION split was not provided by the authors
return [
tfds.core.SplitGenerator(
name=tfds.Split.TRAIN,
name=tfds.Split.TRAIN, # pyrefly: ignore[missing-attribute]
gen_kwargs=dict(
filename_list_path=os.path.join(
extracted_path,
'modelnet40_ply_hdf5_2048/train_files.txt'),)),
tfds.core.SplitGenerator(
name=tfds.Split.TEST,
name=tfds.Split.TEST, # pyrefly: ignore[missing-attribute]
gen_kwargs=dict(
filename_list_path=os.path.join(
extracted_path,
Expand Down
4 changes: 2 additions & 2 deletions tensorflow_graphics/datasets/pix3d/pix3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ def _split_generators(self, dl_manager):

return [
tfds.core.SplitGenerator(
name=tfds.Split.TRAIN,
name=tfds.Split.TRAIN, # pyrefly: ignore[missing-attribute]
gen_kwargs={
'samples_directory': pix3d_dir,
'split_file': self.TRAIN_SPLIT_IDX
},
),
tfds.core.SplitGenerator(
name=tfds.Split.TEST,
name=tfds.Split.TEST, # pyrefly: ignore[missing-attribute]
gen_kwargs={
'samples_directory': pix3d_dir,
'split_file': self.TEST_SPLIT_IDX
Expand Down
6 changes: 3 additions & 3 deletions tensorflow_graphics/datasets/shapenet/shapenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,21 @@ def split_generators(self, dl_manager, dataset_builder):

return [
tfds.core.SplitGenerator(
name=tfds.Split.TRAIN,
name=tfds.Split.TRAIN, # pyrefly: ignore[missing-attribute]
gen_kwargs={
'base_dir': dl_manager.manual_dir,
'models': model_items['train']
},
),
tfds.core.SplitGenerator(
name=tfds.Split.TEST,
name=tfds.Split.TEST, # pyrefly: ignore[missing-attribute]
gen_kwargs={
'base_dir': dl_manager.manual_dir,
'models': model_items['test']
},
),
tfds.core.SplitGenerator(
name=tfds.Split.VALIDATION,
name=tfds.Split.VALIDATION, # pyrefly: ignore[missing-attribute]
gen_kwargs={
'base_dir': dl_manager.manual_dir,
'models': model_items['val']
Expand Down
10 changes: 5 additions & 5 deletions tensorflow_graphics/geometry/convolution/graph_convolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from __future__ import print_function

from typing import Any, Callable, Dict
from six.moves import zip
from six.moves import zip # pyrefly: ignore[missing-source-for-stubs]
import tensorflow as tf

from tensorflow_graphics.geometry.convolution import utils
Expand Down Expand Up @@ -96,7 +96,7 @@ def feature_steered_convolution(
ValueError: if the input dimensions are invalid.
"""
# pyformat: enable
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
data = tf.convert_to_tensor(value=data)
neighbors = tf.compat.v1.convert_to_tensor_or_sparse_tensor(value=neighbors)
if sizes is not None:
Expand Down Expand Up @@ -157,7 +157,7 @@ def feature_steered_convolution(
y_i_m.append(tf.matmul(p_sum, w_m))
y_out = tf.add_n(inputs=y_i_m) + tf.reshape(var_b, [1, -1])
if data_ndims > 2:
y_out = unflatten(y_out)
y_out = unflatten(y_out) # pyrefly: ignore[unbound-name]
return y_out


Expand Down Expand Up @@ -239,7 +239,7 @@ def edge_convolution_template(
ValueError: if the input dimensions are invalid.
"""
# pyformat: enable
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
data = tf.convert_to_tensor(value=data)
neighbors = tf.compat.v1.convert_to_tensor_or_sparse_tensor(value=neighbors)
if sizes is not None:
Expand Down Expand Up @@ -286,7 +286,7 @@ def edge_convolution_template(
tf.compat.dimension_value(edge_features.shape[-1]))))

if data_ndims > 2:
features = unflatten(features)
features = unflatten(features) # pyrefly: ignore[unbound-name]
return features


Expand Down
6 changes: 3 additions & 3 deletions tensorflow_graphics/geometry/convolution/graph_pooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def pool(data: type_alias.TensorLike,
ValueError: if `algorithm` is invalid.
"""
# pyformat: enable
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
data = tf.convert_to_tensor(value=data)
pool_map = tf.compat.v1.convert_to_tensor_or_sparse_tensor(value=pool_map)
if sizes is not None:
Expand Down Expand Up @@ -161,7 +161,7 @@ def unpool(data: type_alias.TensorLike,
ValueError: if the input dimensions are invalid.
"""
# pyformat: enable
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
data = tf.convert_to_tensor(value=data)
pool_map = tf.compat.v1.convert_to_tensor_or_sparse_tensor(value=pool_map)
if sizes is not None:
Expand Down Expand Up @@ -253,7 +253,7 @@ def upsample_transposed_convolution(
ValueError: if the input dimensions are invalid.
"""
# pyformat: enable
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
data = tf.convert_to_tensor(value=data)
pool_map = tf.compat.v1.convert_to_tensor_or_sparse_tensor(value=pool_map)
if sizes is not None:
Expand Down
10 changes: 5 additions & 5 deletions tensorflow_graphics/geometry/convolution/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def flatten_batch_to_2d(data: type_alias.TensorLike,
Raises:
ValueError: if the input tensor dimensions are invalid.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
data = tf.convert_to_tensor(value=data)
if sizes is not None:
sizes = tf.convert_to_tensor(value=sizes)
Expand All @@ -272,7 +272,7 @@ def flatten_batch_to_2d(data: type_alias.TensorLike,

def unflatten(flat, name="utils_unflatten"):
"""Invert flatten_batch_to_2d."""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
flat = tf.convert_to_tensor(value=flat)
output_shape = tf.concat((data_shape[:-1], tf.shape(input=flat)[-1:]),
axis=0)
Expand All @@ -288,7 +288,7 @@ def unflatten(flat, name="utils_unflatten"):

def unflatten(flat, name="utils_unflatten"):
"""Invert flatten_batch_to_2d."""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
flat = tf.convert_to_tensor(value=flat)
output_shape = tf.concat((data_shape[:-1], tf.shape(input=flat)[-1:]),
axis=0)
Expand Down Expand Up @@ -362,7 +362,7 @@ def unflatten_2d_to_batch(data: type_alias.TensorLike,
Returns:
A tensor with shape `[A1, A2, ..., max_rows, D2]`.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
data = tf.convert_to_tensor(value=data)
sizes = tf.convert_to_tensor(value=sizes)
if max_rows is None:
Expand Down Expand Up @@ -418,7 +418,7 @@ def convert_to_block_diag_2d(data: tf.sparse.SparseTensor,
TypeError: if the input types are invalid.
ValueError: if the input dimensions are invalid.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
data = tf.compat.v1.convert_to_tensor_or_sparse_tensor(value=data)
if sizes is not None:
sizes = tf.convert_to_tensor(value=sizes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def energy(vertices_rest_pose: type_alias.TensorLike,
ValueError: if the shape of `vertices_rest_pose`, `vertices_deformed_pose`,
`quaternions`, `edges`, `vertex_weight`, or `edge_weight` is not supported.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
vertices_rest_pose = tf.convert_to_tensor(value=vertices_rest_pose)
vertices_deformed_pose = tf.convert_to_tensor(value=vertices_deformed_pose)
quaternions = tf.convert_to_tensor(value=quaternions)
Expand Down
8 changes: 4 additions & 4 deletions tensorflow_graphics/geometry/representation/mesh/normals.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import numpy as np

from six.moves import range
from six.moves import range # pyrefly: ignore[missing-source-for-stubs]
import tensorflow as tf

from tensorflow_graphics.geometry.representation import triangle
Expand Down Expand Up @@ -54,7 +54,7 @@ def gather_faces(vertices: type_alias.TensorLike,
Raises:
ValueError: If the shape of `vertices` or `indices` is not supported.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
vertices = tf.convert_to_tensor(value=vertices)
indices = tf.convert_to_tensor(value=indices)

Expand Down Expand Up @@ -109,7 +109,7 @@ def face_normals(faces: type_alias.TensorLike,
Raises:
ValueError: If the shape of `vertices`, `faces` is not supported.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
faces = tf.convert_to_tensor(value=faces)

shape.check_static(
Expand Down Expand Up @@ -158,7 +158,7 @@ def vertex_normals(
Raises:
ValueError: If the shape of `vertices`, `indices` is not supported.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
vertices = tf.convert_to_tensor(value=vertices)
indices = tf.convert_to_tensor(value=indices)

Expand Down
12 changes: 6 additions & 6 deletions tensorflow_graphics/geometry/representation/mesh/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def triangle_area(vertex0: type_alias.TensorLike,
A tensor of shape `[A1, ..., An, 1]`, where the last dimension represents
the triangle areas.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
vertex0 = tf.convert_to_tensor(value=vertex0)
vertex1 = tf.convert_to_tensor(value=vertex1)
vertex2 = tf.convert_to_tensor(value=vertex2)
Expand Down Expand Up @@ -116,7 +116,7 @@ def _random_categorical_sample(
Returns:
A `sample_dtype` tensor of shape `[A1, ..., An, num_samples]`.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
asserts.assert_all_above(weights, 0)
logits = tf.math.log(weights)
num_faces = tf.shape(input=logits)[-1]
Expand Down Expand Up @@ -168,7 +168,7 @@ def generate_random_face_indices(
An `int32` tensor of shape `[A1, ..., An, num_samples]` denoting sampled
face indices.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
num_samples = tf.convert_to_tensor(value=num_samples)
face_weights = tf.convert_to_tensor(value=face_weights)
shape.check_static(
Expand Down Expand Up @@ -222,7 +222,7 @@ def generate_random_barycentric_coordinates(


"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
sample_shape = tf.convert_to_tensor(value=sample_shape)
shape.check_static(
tensor=sample_shape, tensor_name="sample_shape", has_rank=1)
Expand Down Expand Up @@ -279,7 +279,7 @@ def weighted_random_sample_triangle_mesh(
where D is dimensionality of each sampled point.
sample_face_indices: A `int` tensor of shape `[A1, ..., An, num_samples]`.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
faces = tf.convert_to_tensor(value=faces)
vertex_attributes = tf.convert_to_tensor(value=vertex_attributes)
face_weights = tf.convert_to_tensor(value=face_weights)
Expand Down Expand Up @@ -369,7 +369,7 @@ def area_weighted_random_sample_triangle_mesh(
where D is dimensionality of each sampled point.
sample_face_indices: A `int` tensor of shape `[A1, ..., An, num_samples]`.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
faces = tf.convert_to_tensor(value=faces)
vertex_attributes = tf.convert_to_tensor(value=vertex_attributes)
num_samples = tf.convert_to_tensor(value=num_samples)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import numpy as np
from scipy import stats
from six.moves import range
from six.moves import range # pyrefly: ignore[missing-source-for-stubs]
import tensorflow.compat.v2 as tf

from tensorflow_graphics.geometry.transformation import axis_angle
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_graphics/image/color_space/linear_rgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def from_srgb(srgb: type_alias.TensorLike,
A tensor of shape `[A_1, ..., A_n, 3]`, where the last dimension represents
RGB values in linear color space.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
srgb = tf.convert_to_tensor(value=srgb)

shape.check_static(
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_graphics/image/color_space/srgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def from_linear_rgb(linear_rgb: type_alias.TensorLike,
A tensor of shape `[A_1, ..., A_n, 3]`, where the last dimension represents
sRGB values.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
linear_rgb = tf.convert_to_tensor(value=linear_rgb)

shape.check_static(
Expand Down
10 changes: 5 additions & 5 deletions tensorflow_graphics/image/matting.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def build_matrices(image: type_alias.TensorLike,
Raises:
ValueError: If `image` is not of rank 4.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
image = tf.convert_to_tensor(value=image)
eps = tf.constant(value=eps, dtype=image.dtype)

Expand Down Expand Up @@ -192,7 +192,7 @@ def linear_coefficients(matte: type_alias.TensorLike,
of rank 4. If `pseudo_inverse` is not of rank 5. If `B` is different
between `matte` and `pseudo_inverse`.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
matte = tf.convert_to_tensor(value=matte)
pseudo_inverse = tf.convert_to_tensor(value=pseudo_inverse)

Expand All @@ -216,7 +216,7 @@ def linear_coefficients(matte: type_alias.TensorLike,
width = tf.shape(input=matte)[2] + size - 1
coeffs = tf.image.resize_with_crop_or_pad(coeffs, height, width)
ones = tf.image.resize_with_crop_or_pad(ones, height, width)
coeffs = _image_average(coeffs, size) / _image_average(ones, size)
coeffs = _image_average(coeffs, size) / _image_average(ones, size) # pyrefly: ignore[unsupported-operation]
return tf.split(coeffs, (-1, 1), axis=-1)


Expand Down Expand Up @@ -246,7 +246,7 @@ def loss(matte: type_alias.TensorLike,
same size. If `laplacian` is not of rank 5. If `B` is different
between `matte` and `laplacian`.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
matte = tf.convert_to_tensor(value=matte)
laplacian = tf.convert_to_tensor(value=laplacian)

Expand Down Expand Up @@ -287,7 +287,7 @@ def reconstruct(image: type_alias.TensorLike,
the last dimension of `coeff_add` is not 1. If the batch dimensions of
`image`, `coeff_mul`, and `coeff_add` do not match.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
image = tf.convert_to_tensor(value=image)
coeff_mul = tf.convert_to_tensor(value=coeff_mul)
coeff_add = tf.convert_to_tensor(value=coeff_add)
Expand Down
10 changes: 5 additions & 5 deletions tensorflow_graphics/image/pyramid.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from typing import Callable, List, Optional, Tuple

import numpy as np
from six.moves import range
from six.moves import range # pyrefly: ignore[missing-source-for-stubs]
import tensorflow as tf

from tensorflow_graphics.util import export_api
Expand Down Expand Up @@ -170,7 +170,7 @@ def downsample(image: type_alias.TensorLike,
Raises:
ValueError: If the shape of `image` is not supported.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
image = tf.convert_to_tensor(value=image)

shape.check_static(tensor=image, tensor_name="image", has_rank=4)
Expand All @@ -196,7 +196,7 @@ def merge(levels: List[type_alias.TensorLike],
Raises:
ValueError: If the shape of the elements of `levels` is not supported.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
levels = [tf.convert_to_tensor(value=level) for level in levels]

for index, level in enumerate(levels):
Expand Down Expand Up @@ -229,7 +229,7 @@ def split(image: type_alias.TensorLike,
Raises:
ValueError: If the shape of `image` is not supported.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
image = tf.convert_to_tensor(value=image)

shape.check_static(tensor=image, tensor_name="image", has_rank=4)
Expand Down Expand Up @@ -264,7 +264,7 @@ def upsample(image: type_alias.TensorLike,
Raises:
ValueError: If the shape of `image` is not supported.
"""
with tf.name_scope(name):
with tf.name_scope(name): # pyrefly: ignore[bad-instantiation]
image = tf.convert_to_tensor(value=image)

shape.check_static(tensor=image, tensor_name="image", has_rank=4)
Expand Down
Loading
Loading