l5kit.planning.vectorized.common module

l5kit.planning.vectorized.common.build_matrix(translation: torch.Tensor, angle: torch.Tensor) Tuple[torch.Tensor, torch.Tensor]

Build transform matrix from translation and angle.

l5kit.planning.vectorized.common.build_target_normalization(nsteps: int) torch.Tensor

Normalization coefficients approximated with 3-rd degree polynomials to avoid storing them explicitly, and allow changing the length

Parameters

nsteps (int) – number of steps to generate normalisation for

Returns

XY scaling for the steps

Return type

torch.Tensor

l5kit.planning.vectorized.common.pad_avail(avails: torch.Tensor, pad_to: int) torch.Tensor

Pad avails to pad_to size

Parameters
  • avails (torch.Tensor) – avails to be padded, should be (B,N,P) and we’re padding P

  • pad_to (int) – nums of points we want

Returns

the padded avails (B,N,pad_to)

Return type

torch.Tensor

l5kit.planning.vectorized.common.pad_points(polylines: torch.Tensor, pad_to: int) torch.Tensor

Pad vectors to pad_to size. Dimensions are: B: batch N: number of elements (polylines) P: number of points F: number of features

Parameters
  • polylines (torch.Tensor) – polylines to be padded, should be (B,N,P,F) and we’re padding P

  • pad_to (int) – nums of points we want

Returns

the padded polylines (B,N,pad_to,F)

Return type

torch.Tensor

l5kit.planning.vectorized.common.transform_points(element: torch.Tensor, matrix: torch.Tensor, avail: torch.Tensor, yaw: Optional[torch.Tensor] = None) torch.Tensor

Transform points element using the translation tr. Reapply avail afterwards to ensure we don’t generate any “ghosts” in the past

Parameters
  • element (torch.Tensor) – tensor with points to transform (B,N,P,3)

  • matrix (torch.Tensor) – Bx3x3 RT matrices

  • avail (torch.Tensor) – the availability of element

  • yaw (Optional[torch.Tensor]) – optional yaws of the rotation matrices to apply to yaws in element

Returns

the transformed tensor

Return type

torch.Tensor