Registry / ai-ml / tensorflow-graphics

tensorflow-graphics

JSON →
library2021.12.3pypypiunverified

A library that provides well-defined, reusable and cleanly written graphics ops and utility functions for TensorFlow, enabling differentiable graphics rendering, transformations, and 3D geometry operations. The latest version on PyPI is 2021.12.3. Releases are infrequent and the library may lag behind TensorFlow releases.

pip install tensorflow-graphics
INSTALL
IMPORT
SIG · TENSORFLOW-GRAPHIC
T
tensorflow-graphics
ai-mlpythonv2021.12.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TriangleMesh
✓ from tensorflow_graphics.geometry.representation.mesh import TriangleMesh
✗ from tensorflow_graphics.mesh import TriangleMesh
Incorrect path - the mesh submodule is under geometry.representation.
perspective
✓ from tensorflow_graphics.geometry.transformation import perspective
✗ from tensorflow_graphics.transforms import perspective
Wrong module; transformation module is under geometry, not top-level.
render
✓ from tensorflow_graphics.rendering import rasterizer
✗ from tensorflow_graphics.render import rasterizer
Rendering submodule is named 'rendering', not 'render'.

Initialize a simple triangle mesh with vertices and face indices, and verify the mesh creation.

import tensorflow as tf import tensorflow_graphics as tfg from tensorflow_graphics.geometry.representation.mesh import TriangleMesh # Create a simple mesh (cube) vertices = tf.constant([ [0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0], [0, 0, 1], [1, 0, 1], [1, 1, 1], [0, 1, 1] ], dtype=tf.float32) faces = tf.constant([ [0, 1, 2], [2, 3, 0], [1, 5, 6], [6, 2, 1], [5, 4, 7], [7, 6, 5], [4, 0, 3], [3, 7, 4], [3, 2, 6], [6, 7, 3], [4, 5, 1], [1, 0, 4] ], dtype=tf.int32) mesh = TriangleMesh(vertices=vertices, indices=faces) print('Mesh vertex count:', tf.shape(mesh.vertices)[0].numpy())
Debug
Known issues
breakingTensorFlow Graphics v2021.x may not be compatible with TensorFlow 2.x later than 2.9. Installing newer tensorflow versions can cause import errors or broken ops.
fix
Pin tensorflow to 2.8-2.9 or use the nightly build from GitHub.
affects: >=2021.12.3
deprecatedThe library has not been actively updated since 2021. Some modules like 'rendering' are experimental and may have breaking changes if future releases occur.
fix
Use with caution; consider alternative libraries for actively maintained features.
affects: all
gotchaExpects TensorFlow eager mode by default; using tf.function on graphics ops may cause unexpected graph tracing errors if the ops have side effects or use Python control flow.
fix
Wrap only pure TF ops inside tf.function; keep graphics-specific ops in eager mode.
affects: all
gotchaMesh face indices must be in counter-clockwise order for correct normal computation, but the library does not validate orientation.
fix
Ensure face winding is consistent; use tfg.geometry.representation.mesh.normals functions to verify.
affects: all
Upgrade
Version history
2021.12.3latest on PyPI · released Dec 3, 2021
Audit
Dependencies
tensorflowrequiredCore framework for tensor operations and autograd
numpyrequiredNumerical operations
scipyoptionalSome geometry routines use scipy
matplotliboptionalVisualization utilities
Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources