This is a problem I encountered many times and I want to finally solve. I wrote this code to demonstrate the problem
import numpy as np import keras import tensor