Is it possible to post ur entire code coz I don’t think the error is in the block of code u posted
Your resize code works just fine to me
What exactly are u feeding into ur network?
Are u feeding both the mask and image?