I would solve this using Keras Subclassing API and unstacking the tensors, decoding them, and stacking them back together. I had to do something like this at work, so am confident the approach will work.