xlnstorch.align_lnstensor_bases

xlnstorch.align_lnstensor_bases#

xlnstorch.align_lnstensor_bases(*tensors, base=None)#

Aligns the bases of a sequence of LNSTensors to a common base.

Parameters:
  • tensors (LNSTensor) – Variable number of LNSTensor objects to be aligned.

  • base (torch.Tensor, optional) – The target base to which all tensors should be aligned. If None, the default base from xl.xlnsB will be used.

Returns:

A tuple containing the LNSTensors with their bases aligned to the specified base or default base. Tensors that already match the base will be returned unchanged.

Return type:

Tuple[LNSTensor, …]

Notes

This function ensures compatibility for operations requiring a common logarithmic base. This operation is tracked by PyTorch’s autograd system to allow for correct gradient computation on the original tensors in their original bases.