class_docstr: Base class for your neural network models.
  
  Example usage::
  
      import numpy as np
      from singa import opt
      from singa import tensor
      from singa import device
      from singa import autograd
      from singa import layer
      from singa import model
  
      class MyModel(model.Model):
          def __init__(self):
              super(MyModel, self).__init__()
  
              self.softmax_cross_entropy = layer.SoftMaxCrossEntropy()
              self.conv1 = layer.Conv2d(1, 20, 5, padding=0)
              self.conv2 = layer.Conv2d(20, 50, 5, padding=0)
              self.sgd = opt.SGD(lr=0.01)
  
          def forward(self, x):
              y = self.conv1(x)
              y = self.conv2(y)
              return y
  
          def train_one_batch(self, x, y):
              out = self.forward(x)
              loss = self.softmax_cross_entropy(out, y)
              self.sgd(loss)
              return out, loss
docstr: Compile and initialize the model
  
  This function will automatically derive the shape of parameters
  in each sublayer based on the shape of input placeholders. It will
  also do some settings.
  
  Args:
      inputs(list): the list of input tensors(placeholders)
      is_train(bool): when is_trainis True, this model will enter
      training mode, otherwise it will enter the evaluation mode
      use_graph(bool): when use_graph is True, computational graph
      will be used to train this model
      sequential(bool): when sequential is True, model will execute ops
      in the graph follow the order of joining the graph
docstr_tok: ["Compile","and","initialize","the","model","This","function","will","automatically","derive","the","shape","of","parameters","in","each","sublayer","based","on","the","shape","of","input","placeholders",".","It","will","also","do","some","settings",".","Args",":","inputs","(","list",")",":","the","list","of","input","tensors","(","placeholders",")","is_train","(","bool",")",":","when","is_trainis","True",",","this","model","will","enter","training","mode",",","otherwise","it","will","enter","the","evaluation","mode","use_graph","(","bool",")",":","when","use_graph","is","True",",","computational","graph","will","be","used","to","train","this","model","sequential","(","bool",")",":","when","sequential","is","True",",","model","will","execute","ops","in","the","graph","follow","the","order","of","joining","the","graph"]
code: def compile(
      self, inputs, is_train=True, use_graph=False, sequential=False
  ):
      """Compile and initialize the model
  
      This function will automatically derive the shape of parameters
      in each sublayer based on the shape of input placeholders. It will
      also do some settings.
  
      Args:
          inputs(list): the list of input tensors(placeholders)
          is_train(bool): when is_trainis True, this model will enter
          training mode, otherwise it will enter the evaluation mode
          use_graph(bool): when use_graph is True, computational graph
          will be used to train this model
          sequential(bool): when sequential is True, model will execute ops
          in the graph follow the order of joining the graph
      """
      assert len(inputs) > 0 and isinstance(
          inputs[0], Tensor
      ), "compile function expects PlaceHolders or Tensors"
  
      dev = inputs[0].device
      dev.EnableGraph(True)
      self.forward(*inputs)
      dev.EnableGraph(False)
      dev.ResetGraph()
  
      autograd.training = is_train
      self.training = is_train
      self.graph_mode = use_graph
      self.sequential = sequential
  
imports: import os
  import gc
  import time
  import json
  import zipfile
  import numpy
  from functools import wraps
  from collections import Iterable
  from singa import tensor
  from singa import autograd
  from singa import layer
  from .tensor import Tensor
  from .None import singa_wrap
label_desc: Use image node_id 2 for calling the Model obj's underlying member method code with example usage: obj.compile(inputs, is_train, use_graph, sequential) without return types