class_docstr: Create and run the model. We try with both storing indices for gather
  on CPU and on GPU
docstr: Test that the model has same number of indices and gradient rows
  given total batchsize, independent of number of GPUs.
docstr_tok: ["Test","that","the","model","has","same","number","of","indices","and","gradient","rows","given","total","batchsize",",","independent","of","number","of","GPUs","."]
code: def test_sparse_shared_indices_gpu(self):
      """
      Test that the model has same number of indices and gradient rows
      given total batchsize, independent of number of GPUs.
      """
      V = 10000
      self.run_model(V, [0, 1])
      self.run_model(V, [0])
  
      if workspace.NumGpuDevices() >= 4:
          self.run_model(V, list(range(4)))
  
      if workspace.NumGpuDevices() >= 8:
          self.run_model(V, list(range(8)))
  
imports: from multiprocessing import Process, Queue
  import numpy
  import os
  import shutil
  import tempfile
  import unittest
  import time
  from unittest.mock import Mock
  from hypothesis import assume, given, settings
  import hypothesis.strategies
  from caffe2.proto import caffe2_pb2
  from caffe2.python import brew, core, cnn, data_parallel_model, dyndep, model_helper, optimizer, rnn_cell, workspace
  from caffe2.python.test_util import TestCase
label_desc: Use image node_id 2 for calling the SparseDataParallelModelTestWithSharedIndices obj's underlying member method code with example usage: obj.test_sparse_shared_indices_gpu() without return types