def points_offset_in_voxels(points, grid_cell_size):
  """Converts points into offsets in voxel grid.

  Args:
    points: A tf.float32 tensor of size [batch_size, N, 3].
    grid_cell_size: The size of the grid cells in x, y, z dimensions in the
      voxel grid. It should be either a tf.float32 tensor, a numpy array or a
      list of size [3].

  Returns:
    voxel_xyz_offsets: A tf.float32 tensor of size [batch_size, N, 3].
  """
  batch_size = points.get_shape().as_list()[0]

  def fn(i):
    return _points_offset_in_voxels_unbatched(
        points=points[i, :, :], grid_cell_size=grid_cell_size)

  return tf.map_fn(fn=fn, elems=tf.range(batch_size), dtype=tf.float32)