Handle nested dict/lists of tensors as inputs in the Trainer
# What does this PR do?

This PR refactors the `_prepare_inputs` method of the Trainer to make it recursively handle any nested list/dict of tensors.

Fixes #13146