Thanks, I see better this example and the problem you are facing. At the moment, we can not just use create_supervised_trainer with a custom prepare_batch function without a hack like replacing it by a custom one like :
ignite.engine._prepare_batch =  _foo_prep_batch

Could you please provide a basic model and loss function for this example to see whether it is only prepare_batch that you need to change ?
In general case we suggest to define processing_function (as _update in create_supervised_trainer) for Engine, however we were already asked several times to have such possibility to reuse create_supervised_trainer with a custom _prepare_batch. Let us see if we could find a flexible solution…