(aspect_ratio, fov_y, near_clip, far_clip)
return tf.transpose(perspective_transform, [2, 0, 1])
Computes perspective transformation matrices.

  Functionality mimes gluPerspective (third_party/GL/glu/include/GLU/glu.h).

  Args:
    aspect_ratio: float value specifying the image aspect ratio (width/height).
    fov_y: 1-D float32 Tensor with shape [batch_size] specifying output vertical
        field of views in degrees.
    near_clip: 1-D float32 Tensor with shape [batch_size] specifying near
        clipping plane distance.
    far_clip: 1-D float32 Tensor with shape [batch_size] specifying far clipping
        plane distance.

  Returns:
    A [batch_size, 4, 4] float tensor that maps from right-handed points in eye
    space to left-handed points in clip space.
Computes perspective transformation matrices.
Computes perspective transformation matrices .
def perspective(aspect_ratio, fov_y, near_clip, far_clip):
  """Computes perspective transformation matrices.

  Functionality mimes gluPerspective (third_party/GL/glu/include/GLU/glu.h).

  Args:
    aspect_ratio: float value specifying the image aspect ratio (width/height).
    fov_y: 1-D float32 Tensor with shape [batch_size] specifying output vertical
        field of views in degrees.
    near_clip: 1-D float32 Tensor with shape [batch_size] specifying near
        clipping plane distance.
    far_clip: 1-D float32 Tensor with shape [batch_size] specifying far clipping
        plane distance.

  Returns:
    A [batch_size, 4, 4] float tensor that maps from right-handed points in eye
    space to left-handed points in clip space.
  """
  # The multiplication of fov_y by pi/360.0 simultaneously converts to radians
  # and adds the half-angle factor of .5.
  focal_lengths_y = 1.0 / tf.tan(fov_y * (math.pi / 360.0))
  depth_range = far_clip - near_clip
  p_22 = -(far_clip + near_clip) / depth_range
  p_23 = -2.0 * (far_clip * near_clip / depth_range)

  zeros = tf.zeros_like(p_23, dtype=tf.float32)
  # pyformat: disable
  perspective_transform = tf.concat(
      [
          focal_lengths_y / aspect_ratio, zeros, zeros, zeros,
          zeros, focal_lengths_y, zeros, zeros,
          zeros, zeros, p_22, p_23,
          zeros, zeros, -tf.ones_like(p_23, dtype=tf.float32), zeros
      ], axis=0)
  # pyformat: enable
  perspective_transform = tf.reshape(perspective_transform, [4, 4, -1])
  return tf.transpose(perspective_transform, [2, 0, 1])
def perspective ( aspect_ratio , fov_y , near_clip , far_clip ) : # The multiplication of fov_y by pi/360.0 simultaneously converts to radians # and adds the half-angle factor of .5. focal_lengths_y = 1.0 / tf . tan ( fov_y * ( math . pi / 360.0 ) ) depth_range = far_clip - near_clip p_22 = - ( far_clip + near_clip ) / depth_range p_23 = - 2.0 * ( far_clip * near_clip / depth_range ) zeros = tf . zeros_like ( p_23 , dtype = tf . float32 ) # pyformat: disable perspective_transform = tf . concat ( [ focal_lengths_y / aspect_ratio , zeros , zeros , zeros , zeros , focal_lengths_y , zeros , zeros , zeros , zeros , p_22 , p_23 , zeros , zeros , - tf . ones_like ( p_23 , dtype = tf . float32 ) , zeros ] , axis = 0 ) # pyformat: enable perspective_transform = tf . reshape ( perspective_transform , [ 4 , 4 , - 1 ] ) return tf . transpose ( perspective_transform , [ 2 , 0 , 1 ] )