class_docstr: Provide test coverage when using provided estimators for optimal number of
  bins
class_docstr_tok: ["Provide","test","coverage","when","using","provided","estimators","for","optimal","number","of","bins"]
docstr: Straightforward testing with a mixture of linspace data (for
  consistency). All test values have been precomputed and the values
  shouldn't change
docstr_tok: ["Straightforward","testing","with","a","mixture","of","linspace","data","(","for","consistency",")",".","All","test","values","have","been","precomputed","and","the","values","should","n't","change"]
code: def test_simple(self):
      """
      Straightforward testing with a mixture of linspace data (for
      consistency). All test values have been precomputed and the values
      shouldn't change
      """
      # Some basic sanity checking, with some fixed data.
      # Checking for the correct number of bins
      basic_test = {
          50: {
              "fd": 4,
              "scott": 4,
              "rice": 8,
              "sturges": 7,
              "doane": 8,
              "sqrt": 8,
              "auto": 7,
              "stone": 2,
          },
          500: {
              "fd": 8,
              "scott": 8,
              "rice": 16,
              "sturges": 10,
              "doane": 12,
              "sqrt": 23,
              "auto": 10,
              "stone": 9,
          },
          5000: {
              "fd": 17,
              "scott": 17,
              "rice": 35,
              "sturges": 14,
              "doane": 17,
              "sqrt": 71,
              "auto": 17,
              "stone": 20,
          },
      }
  
      for testlen, expectedResults in basic_test.items():
          # Create some sort of non uniform data to test with
          # (2 peak uniform mixture)
          x1 = np.linspace(-10, -1, testlen // 5 * 2)
          x2 = np.linspace(1, 10, testlen // 5 * 3)
          x = np.concatenate((x1, x2))
          for estimator, numbins in expectedResults.items():
              a, b = np.histogram(x, estimator)
              assert_equal(
                  len(a),
                  numbins,
                  err_msg=f"For the {estimator} estimator "
                  f"with datasize of {testlen}",
              )
  
imports: import functools
  from unittest import expectedFailure, skipIf
  from pytest import raises
  from torch.testing._internal.common_utils import instantiate_parametrized_tests, parametrize, run_tests, slowTest, TEST_WITH_TORCHDYNAMO, TestCase, xpassIfTorchDynamo
label_desc: Use image node_id 2 for calling the TestHistogramOptimBinNums obj's underlying member method code with example usage: obj.test_simple() without return types