generalized the dropout function