implement trunk of auto encoder