code: def read(cls, proto):
      
      sparsenet = object.__new__(cls)
  
      sparsenet.filterDim = proto.filterDim
      sparsenet.outputDim = proto.outputDim
      sparsenet.batchSize = proto.batchSize
  
      lossHistoryProto = proto.losses
      sparsenet.losses = {}
      for i in xrange(len(lossHistoryProto)):
        sparsenet.losses[lossHistoryProto[i].iteration] = lossHistoryProto[i].loss
      sparsenet._iteration = proto.iteration
  
      sparsenet.basis = np.reshape(proto.basis, newshape=(sparsenet.filterDim,
                                                          sparsenet.outputDim))
  
      # training parameters
      sparsenet.learningRate = proto.learningRate
      sparsenet.decayCycle = proto.decayCycle
      sparsenet.learningRateDecay = proto.learningRateDecay
  
      # LCA parameters
      sparsenet.numLcaIterations = proto.numLcaIterations
      sparsenet.lcaLearningRate = proto.lcaLearningRate
      sparsenet.thresholdDecay = proto.thresholdDecay
      sparsenet.minThreshold = proto.minThreshold
      sparsenet.thresholdType = proto.thresholdType
  
      # debugging
      sparsenet.verbosity = proto.verbosity
      sparsenet.showEvery = proto.showEvery
      sparsenet.seed = int(proto.seed)
      if sparsenet.seed is not None:
        np.random.seed(sparsenet.seed)
        random.seed(sparsenet.seed)
  
      return sparsenet
docs: Reads deserialized data from proto object
  
      :param proto: (DynamicStructBuilder) Proto object
      :return       (SparseNet)            SparseNet instance