class_docstr: Class for parallel processing with `Parallelizable`s. It invokes a
  `Parallelizable` with multiple Python threads. For example::
      class ParallelNet(Parallelizable):
          def __init__(self):
              self._net = Model()
              self._loss = gluon.loss.SoftmaxCrossEntropyLoss()
          def forward_backward(self, x):
              data, label = x
              mx.autograd.record():
                  out = self._net(data)
                  loss = self._loss(out, label)
              loss.backward()
              return loss
      net = ParallelNet()
      ctx = [mx.gpu(0), mx.gpu(1)]
      parallel = Parallel(len(ctx), net)
      for batch in batches:
          for x in gluon.utils.split_and_load(batch, ctx):
              parallel.put(x)
          losses = [parallel.get() for _ in ctx]
          trainer.step()
  Parameters
  ----------
  num_workers : int
      Number of worker threads. If set to 0, the main thread is used as the worker for
      debugging purpose.
  parallelizable :
      Parallelizable net whose `forward` and `backward` methods are invoked
      by multiple worker threads.
  serial_init : bool, default True
      Execute the first `num_workers` inputs in main thread, so that the `Block`
      used in `parallizable` is initialized serially. Initialize a `Block` with
      multiple threads may cause unexpected behavior.
class_docstr_tok: ["Class","for","parallel","processing","with","`","Parallelizable","`","s",".","It","invokes","a","`","Parallelizable","`","with","multiple","Python","threads",".","For","example",":",":","class","ParallelNet","(","Parallelizable",")",":","def","__init__","(","self",")",":","self._net","=","Model","(",")","self._loss","=","gluon.loss.SoftmaxCrossEntropyLoss","(",")","def","forward_backward","(","self",",","x",")",":","data",",","label","=","x","mx.autograd.record","(",")",":","out","=","self._net","(","data",")","loss","=","self._loss","(","out",",","label",")","loss.backward","(",")","return","loss","net","=","ParallelNet","(",")","ctx","=","[","mx.gpu","(","0",")",",","mx.gpu","(","1",")","]","parallel","=","Parallel","(","len","(","ctx",")",",","net",")","for","batch","in","batches",":","for","x","in","gluon.utils.split_and_load","(","batch",",","ctx",")",":","parallel.put","(","x",")","losses","=","[","parallel.get","(",")","for","_","in","ctx","]","trainer.step","(",")","Parameters","--","--","--","--","--","num_workers",":","int","Number","of","worker","threads",".","If","set","to","0",",","the","main","thread","is","used","as","the","worker","for","debugging","purpose",".","parallelizable",":","Parallelizable","net","whose","`","forward","`","and","`","backward","`","methods","are","invoked","by","multiple","worker","threads",".","serial_init",":","bool",",","default","True","Execute","the","first","`","num_workers","`","inputs","in","main","thread",",","so","that","the","`","Block","`","used","in","`","parallizable","`","is","initialized","serially",".","Initialize","a","`","Block","`","with","multiple","threads","may","cause","unexpected","behavior","."]
docstr: Get an output of previous `parallizable.forward_backward` calls.
  This method blocks if none of previous `parallizable.forward_backward`
  calls have return any result. 
docstr_tok: ["Get","an","output","of","previous","`","parallizable.forward_backward","`","calls",".","This","method","blocks","if","none","of","previous","`","parallizable.forward_backward","`","calls","have","return","any","result","."]
code: def get(self):
      """Get an output of previous `parallizable.forward_backward` calls.
      This method blocks if none of previous `parallizable.forward_backward`
      calls have return any result."""
      return self._out_queue.get()
  
imports: import threading
  from mxnet import autograd
  from mxnet.gluon.utils import split_and_load
  from mxnet.ndarray import NDArray
label_desc: Use image node_id 3 for calling the Parallel obj's underlying member method code with example usage: obj.get() and returns: self