function checkShape(data, shape) {
  if (data.length && shape.length && data.length !== shape.reduce((a, b) => a * b, 1)) {
    throw new Error('[Tensor] specified shape incompatible with data.')
  }
}
Function to throw error if specified shape is incompatible with data

@param {number[]} data
@param {number[]} shape