code: def area_weighted_random_sample_triangle_mesh(
      vertex_attributes: type_alias.TensorLike,
      faces: type_alias.TensorLike,
      num_samples: int,
      vertex_positions: Optional[type_alias.TensorLike] = None,
      seed: Optional[type_alias.TensorLike] = None,
      stateless: bool = False,
      name: str = "area_weighted_random_sample_triangle_mesh",
  ) -> Tuple[type_alias.TensorLike, type_alias.TensorLike]:
      """Performs a face area weighted random sampling of a tri mesh.
  
      Note:
        In the following, A1 to An are optional batch dimensions.
  
      Args:
        vertex_attributes: A `float` tensor of shape `[A1, ..., An, V, D]`, where V
          is the number of vertices, and D is dimensionality of a feature defined on
          each vertex. If `vertex_positions` is not provided, then first 3
          dimensions of `vertex_attributes` denote the vertex positions.
        faces: A `int` tensor of shape `[A1, ..., An, F, 3]`, where F is the number
          of faces.
        num_samples: An `int` scalar denoting number of samples to be drawn from
          each mesh.
        vertex_positions: An optional `float` tensor of shape `[A1, ..., An, V, 3]`,
          where V is the number of vertices. If None, then vertex_attributes[...,
            :3] is used as vertex positions.
        seed: Optional random seed.
        stateless: Optional flag to use stateless random sampler. If stateless=True,
          then seed must be provided as shape `[2]` int tensor. Stateless random
          sampling is useful for testing to generate same sequence across calls.
        name: Name for op. Defaults to "area_weighted_random_sample_triangle_mesh".
  
      Returns:
        sample_pts: A `float` tensor of shape `[A1, ..., An, num_samples, D]`,
          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):
          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)
  
          shape.check_static(
              tensor=vertex_attributes,
              tensor_name="vertex_attributes",
              has_rank_greater_than=1,
          )
          shape.check_static(
              tensor=vertex_attributes,
              tensor_name="vertex_attributes",
              has_dim_greater_than=(-1, 2),
          )
  
          if vertex_positions is not None:
              vertex_positions = tf.convert_to_tensor(
                  value=vertex_positions
              )
          else:
              vertex_positions = vertex_attributes[..., :3]
  
          shape.check_static(
              tensor=vertex_positions,
              tensor_name="vertex_positions",
              has_rank_greater_than=1,
          )
          shape.check_static(
              tensor=vertex_positions,
              tensor_name="vertex_positions",
              has_dim_equals=(-1, 3),
          )
  
          triangle_vertex_positions = normals.gather_faces(
              vertex_positions, faces
          )
          triangle_areas = triangle_area(
              triangle_vertex_positions[..., 0, :],
              triangle_vertex_positions[..., 1, :],
              triangle_vertex_positions[..., 2, :],
          )
          return weighted_random_sample_triangle_mesh(
              vertex_attributes,
              faces,
              num_samples,
              face_weights=triangle_areas,
              seed=seed,
              stateless=stateless,
          )
  
file_path: graphics/tensorflow_graphics/geometry/representation/mesh/sampler.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from typing import Optional, Tuple
  import tensorflow
  from tensorflow_graphics.geometry.representation import triangle
  from tensorflow_graphics.geometry.representation.mesh import normals
  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
label_desc: Use image node_id 6 for calling a global function with example usage: area_weighted_random_sample_triangle_mesh(vertex_attributes, faces, num_samples, vertex_positions, seed, stateless, name) and returns: weighted_random_sample_triangle_mesh