Is it possible to constraint onehotencoding without using any special functions?

I think this is what you are looking for .