Validate input shapes. (#1352)
* Validate input shapes.
* Cache some input def metadata
* Make some methods const and check for negative values of dims instead of just -1.
* Fix shape inferencing test.
* Fix testLabelEncoder test
* Fix more tests
* Fix more tests
* Use size_t for loop variable