xlnstorch.csrc.change_base_backward

xlnstorch.csrc.change_base_backward#

xlnstorch.csrc.change_base_backward(grad, old_base, new_base)#

Change the base of the gradient tensor from LNS representation.

Parameters:
  • grad (torch.Tensor) – The gradient tensor in LNS format (torch.int64).

  • old_base (torch.Tensor) – The original base of the LNS tensor (input to forward).

  • new_base (torch.Tensor) – The base of the gradient tensor (same baseas output to forward).

Returns:

The output gradient tensor in LNS format (torch.int64) with the old base.

Return type:

torch.Tensor