Add array data as an optional parameter to get_shape

This allows leading var_dim shapes to be included.