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
2 changes: 1 addition & 1 deletion diffren/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/common/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/common/compare_images.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/common/kernels/rasterize_test_utils.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2024 The diffren Authors.
/* Copyright 2026 The diffren Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/common/kernels/rasterize_test_utils.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2024 The diffren Authors.
/* Copyright 2026 The diffren Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/common/kernels/rasterize_triangles_impl.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2024 The diffren Authors.
/* Copyright 2026 The diffren Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/common/kernels/rasterize_triangles_impl.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2024 The diffren Authors.
/* Copyright 2026 The diffren Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/common/kernels/rasterize_triangles_impl_cuda.cu.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2024 The diffren Authors.
/* Copyright 2026 The diffren Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/common/kernels/rasterize_triangles_impl_cuda.cu.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2024 The diffren Authors.
/* Copyright 2026 The diffren Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2024 The diffren Authors.
/* Copyright 2026 The diffren Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/common/kernels/rasterize_triangles_impl_test.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2024 The diffren Authors.
/* Copyright 2026 The diffren Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/common/kernels/rasterize_triangles_types.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2024 The diffren Authors.
/* Copyright 2026 The diffren Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/common/kernels/rasterize_utils.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2024 The diffren Authors.
/* Copyright 2026 The diffren Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
12 changes: 6 additions & 6 deletions diffren/common/obj_loader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -92,13 +92,13 @@ def load_and_flatten_obj(obj_path):
flat_triangles.append(triangle)

# Keep only vertex types that are used in at least one vertex.
flat_vertices_array = np.float32(flat_vertices_list)
flat_vertices = flat_vertices_array[:, :3]
flat_vertices_array = np.float32(flat_vertices_list) # pyrefly: ignore[bad-argument-type]
flat_vertices = flat_vertices_array[:, :3] # pyrefly: ignore[bad-index]
if has_type['vt']:
flat_vertices = np.concatenate((flat_vertices, flat_vertices_array[:, 3:5]),
flat_vertices = np.concatenate((flat_vertices, flat_vertices_array[:, 3:5]), # pyrefly: ignore[bad-index]
axis=-1)
if has_type['vn']:
flat_vertices = np.concatenate((flat_vertices, flat_vertices_array[:, -3:]),
flat_vertices = np.concatenate((flat_vertices, flat_vertices_array[:, -3:]), # pyrefly: ignore[bad-index]
axis=-1)

return flat_vertices, np.int32(flat_triangles)
return flat_vertices, np.int32(flat_triangles) # pyrefly: ignore[bad-argument-type]
2 changes: 1 addition & 1 deletion diffren/common/obj_loader_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions diffren/common/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -49,7 +49,7 @@ def eye_position(view_name):
elif view_name.startswith('spot'):
eye = np.array((0.2, 0.3, -0.5))
world_up = np.array((0.0, -1.0, 0.0))
return eye, world_up
return eye, world_up # pyrefly: ignore[unbound-name]


def make_look_at_matrix(view_name):
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions diffren/jax/camera.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -40,7 +40,7 @@ def perspective(aspect_ratio: float, fov_y: float, near_clip: float,
# and adds the half-angle factor of .5.
focal_length_y = 1.0 / jnp.tan(fov_y * (math.pi / 360.0))
return perspective_from_intrinsics(focal_length_y / aspect_ratio, # pytype: disable=wrong-arg-types # jax-types
focal_length_y, 0.0, 0.0, near_clip,
focal_length_y, 0.0, 0.0, near_clip, # pyrefly: ignore[bad-argument-type]
far_clip, 2, 2)


Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/camera_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/composite.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/internal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions diffren/jax/internal/framebuffer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -121,7 +121,7 @@ def layer(self, index):
return self

return Framebuffer(
triangle_id=self.triangle_id[:, index, ...]
triangle_id=self.triangle_id[:, index, ...] # pyrefly: ignore[bad-argument-type]
if self.triangle_id is not None else None,
vertex_ids=self.vertex_ids[:, index, ...],
foreground_mask=self.foreground_mask[:, index, ...],
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/internal/framebuffer_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/internal/interpolate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/internal/interpolate_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/internal/kernels/rasterize_triangles_cpu.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2024 The diffren Authors.
/* Copyright 2026 The diffren Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/internal/kernels/rasterize_triangles_gpu.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2024 The diffren Authors.
/* Copyright 2026 The diffren Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/internal/kernels/rasterize_triangles_xla.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions diffren/jax/internal/rasterize.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -162,7 +162,7 @@ def compute_single_pixel_coordinates(triangle_id, px, py):
# Mask out barycentrics for background pixels.
barycentric_coords = barycentric_coords * framebuffer.foreground_mask

return framebuffer.replace(barycentrics=barycentric_coords)
return framebuffer.replace(barycentrics=barycentric_coords) # pyrefly: ignore[missing-attribute]


def normalized_pixel_coordinates(image_width, image_height):
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/internal/rasterize_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/internal/splat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
8 changes: 4 additions & 4 deletions diffren/jax/internal/splat_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -60,8 +60,8 @@ def test_two_triangle_layers(self):

composite, _, normalized_layers = render.render_triangles( # pytype: disable=wrong-arg-types # jax-ndarray
vertices, {'colors': colors},
triangles,
None,
triangles, # pyrefly: ignore[bad-argument-type]
None, # pyrefly: ignore[bad-argument-type]
image_width,
image_height,
lambda x: x['colors'],
Expand Down Expand Up @@ -118,7 +118,7 @@ def render_inner(
return render.render_triangles( # pytype: disable=wrong-arg-types # jax-ndarray
vertices_slice, {'colors': attributes_slice},
triangles,
None,
None, # pyrefly: ignore[bad-argument-type]
image_width,
image_height,
lambda x: x['colors'],
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/render.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
6 changes: 3 additions & 3 deletions diffren/jax/render_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -90,8 +90,8 @@ def render_for_vmap(v, a, t, p):
face_culling_mode=constants.FaceCullingMode.NONE,
compositing_mode=constants.CompositingMode.OVER)

rendered = jax.vmap(render_for_vmap, in_axes)(vertices, attributes,
triangles, self.projection)
rendered = jax.vmap(render_for_vmap, in_axes)(vertices, attributes, # pyrefly: ignore[unbound-name]
triangles, self.projection) # pyrefly: ignore[unbound-name]

for i in (0, 1):
test_utils.check_image(self, np.array(rendered[i, :, :, :]),
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/utils/depthmap.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/utils/depthmap_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/utils/image.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/utils/image_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/utils/mesh.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/utils/mesh_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/utils/shaders.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/utils/shaders_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/utils/transforms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion diffren/jax/utils/transforms_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The diffren Authors.
# Copyright 2026 The diffren Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Loading