class_docstr: Base class for parallelizable unit of work, which can be invoked by `Parallel`.
  The subclass must implement the `forward_backward` method, and be used
  together with `Parallel`. For example::
      class ParallelNet(Parallelizable):
          def __init__(self):
              self._net = Model()
              self._loss = gluon.loss.SoftmaxCrossEntropyLoss()
          def forward_backward(self, x):
              data, label = x
              with 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)
      # Gluon block is initialized after forwarding the first batch
      initialized = False
      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()
class_docstr_tok: ["Base","class","for","parallelizable","unit","of","work",",","which","can","be","invoked","by","`","Parallel","`",".","The","subclass","must","implement","the","`","forward_backward","`","method",",","and","be","used","together","with","`","Parallel","`",".","For","example",":",":","class","ParallelNet","(","Parallelizable",")",":","def","__init__","(","self",")",":","self._net","=","Model","(",")","self._loss","=","gluon.loss.SoftmaxCrossEntropyLoss","(",")","def","forward_backward","(","self",",","x",")",":","data",",","label","=","x","with","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",")","#","Gluon","block","is","initialized","after","forwarding","the","first","batch","initialized","=","False","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","(",")"]
docstr: Forward and backward computation. 
docstr_tok: ["Forward","and","backward","computation","."]
code: def forward_backward(self, x):
      """Forward and backward computation."""
      raise NotImplementedError()
  
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 1 for calling the Parallelizable obj's underlying member method code with example usage: obj.forward_backward(x) without return types