Added code to calculate new shape when '-1' is provided as a value for a...

... dimension.