Based on your image you could either use direct indexing or e.g. masked_scatter_:
A = torch.zeros(3, 5, 5)
B = torch.randn(3, 2, 2)

A[0, 1:3, 1:3] = B[0]
A[1, 0:2, 3:5] = B[1]
A[2, 3:5, 0:2] = B[2]
print(A)

A = torch.zeros(3, 5, 5)
mask = torch.zeros(3, 5, 5).bool()
mask[0, 1:3, 1:3] = True
mask[1, 0:2, 3:5] = True
mask[2, 3:5, 0:2] = True
A.masked_scatter_(mask, B)
print(A)

I don’t know how the indices are created and which approach might be preferred.