Fix for the OneHot Error

A fix for response to this thread: https://groups.google.com/forum/#!topic/pylearn-dev/k1w4vnUa2CM

It's a bit messy in a sense that it's not abstract enough and have lots of special case ifs but does the job. Anyone has better suggestion?