API Reference

polyline

accvlab.lane_helpers.polyline.interpolate(points, distances, *, relative=False)[source]

Interpolate batched polylines at requested distances.

Parameters:
  • points (Tensor) – CPU or CUDA tensor with shape (batch, num_points, num_dims).

  • distances (Tensor) – Tensor with shape (batch, num_distances) on the same device as points. Distances below zero are clamped to the first point of the polyline. Distances beyond the total polyline length are clamped to the last point. When relative=True, this corresponds to clamping values below 0 and above 1.

  • relative (bool, default: False) – If True, interpret distances as fractions of each polyline’s total length. If False, interpret them as absolute distances from the start of each polyline.

Returns:

Tensor – Tensor with shape (batch, num_distances, num_dims) on the same device as points.

accvlab.lane_helpers.polyline.interpolate_var_size_batch(points, distances, *, relative=False)[source]

Interpolate variable-length batched polylines at requested distances.

Parameters:
  • points (RaggedBatch) – RaggedBatch-like object with tensor data on CPU or CUDA and shape (batch, max_num_points, num_dims).

  • distances (RaggedBatch) – RaggedBatch-like object with shape (batch, max_num_distances) and tensor data on the same device as points. Distances below zero are clamped to the first point of the polyline. Distances beyond the total polyline length are clamped to the last point. When relative=True, this corresponds to clamping values below 0 and above 1.

  • relative (bool, default: False) – If True, interpret distances as fractions of each polyline’s total length. If False, interpret them as absolute distances from the start of each polyline.

Returns:

RaggedBatch – RaggedBatch-like object with shape (batch, max_num_distances, num_dims) and tensor data on the same device as points.

accvlab.lane_helpers.polyline.lengths(points)[source]

Compute the total length of each polyline in a fixed-size batch.

Parameters:

points (Tensor) – CPU or CUDA tensor with shape (batch, num_points, num_dims).

Returns:

Tensor – Tensor with shape (batch,) on the same device as points.

accvlab.lane_helpers.polyline.lengths_var_size_batch(points)[source]

Compute the total length of each polyline in a variable-size batch.

Parameters:

points (RaggedBatch) – RaggedBatch-like object with tensor data on CPU or CUDA and shape (batch, max_num_points, num_dims).

Returns:

Tensor – Tensor with shape (batch,) on the same device as points.