The issue is solved, with both the kind help from @JuanFMontesinos and at https://github.com/kornia/kornia/issues/682 2
learn_x_translation_0.30000001192092896_y_translation_-0.20000000298023224_entropy_0.01_step_720×720 1.61 MB
The  only  problem was placing  translations = torch.stack([x_translation, y_translation], 1)  at the  init () rather than in the forward().
FYI all the inplace operations do not interfere with the differentiation as those are all differentiable, i,e, both:
translations[:, 0] *= h translations[:, 1] *= w
And:
M[..., 2] += translations
Eventually the working code is:
class DTranslation(nn.Module):
    def __init__(self, x_translation, y_translation):
        super(DTranslation, self).__init__()
        self.x_translation = x_translation
        self.y_translation = y_translation
        self.angle = torch.tensor([0])
        
        
    def forward(self, input):
        _, _, h, w = input.shape
        if self.angle.shape[0] != input.shape[0]:
            angle = self.angle.repeat(input.shape[0])
        else:
            angle = self.angle
            
        translations = torch.stack([self.x_translation, self.y_translation], 1)
        if translations.shape[0] != input.shape[0]:
            translations = translations.repeat([input.shape[0], 1])
        else:
            translations = translations
            
        translations[:, 0] *= h
        translations[:, 1] *= w
        
        # define the rotation center
        center = torch.ones(2)
        center[..., 0] = input.shape[3] / 2  # x
        center[..., 1] = input.shape[2] / 2  # y
        center = center.repeat(input.shape[0], 1)

        # define the scale factor
        scale = torch.ones(input.shape[0])

        # compute the transformation matrix
        M = kornia.get_rotation_matrix2d(center, -angle, scale)
        
        # Translate
        M[..., 2] += translations  # tx/ty
        
        # apply the transformation to original image
        out = kornia.warp_affine(input, M, dsize=(h, w))
        
        return out

Closing this issue.