code: def test_sample_grid(nb_instances, nb_samples, input_shape):
      x = np.ones((nb_instances,) + input_shape)
      nb_features = x.reshape(x.shape[0], -1).shape[1]
      feature_range = np.array([[0, 1] for _ in range(nb_features)])
  
      X_samples = _sample_grid(x, feature_range, nb_samples=nb_samples)
  
      assert X_samples.shape[0] == nb_instances
      assert X_samples.shape[1] == nb_samples
  
file_path: alibi/alibi/confidence/tests/test_model_linearity.py
imports: import pytest
  import numpy
  from sklearn.datasets import load_iris, load_diabetes
  from sklearn.linear_model import LogisticRegression, LinearRegression
  from sklearn.svm import SVR
  from alibi.confidence.model_linearity import linearity_measure, LinearityMeasure
  from alibi.confidence.model_linearity import _linear_superposition, _sample_grid, _sample_knn
  from functools import reduce
label_desc: Use image node_id 3 for calling a global function with example usage: test_sample_grid(nb_instances, nb_samples, input_shape) without return types