code: def write(self, proto):
      
      proto.filterDim = self.filterDim
      proto.outputDim = self.outputDim
      proto.batchSize = self.batchSize
  
      lossHistoryProto = proto.init("losses", len(self.losses))
      i = 0
      for iteration, loss in self.losses.iteritems():
        iterationLossHistoryProto = lossHistoryProto[i]
        iterationLossHistoryProto.iteration = iteration
        iterationLossHistoryProto.loss = float(loss)
        i += 1
  
      proto.iteration = self._iteration
  
      proto.basis = list(
        self.basis.flatten().astype(type('float', (float,), {}))
      )
  
      # training parameters
      proto.learningRate = self.learningRate
      proto.decayCycle = self.decayCycle
      proto.learningRateDecay = self.learningRateDecay
  
      # LCA parameters
      proto.numLcaIterations = self.numLcaIterations
      proto.lcaLearningRate = self.lcaLearningRate
      proto.thresholdDecay = self.thresholdDecay
      proto.minThreshold = self.minThreshold
      proto.thresholdType = self.thresholdType
  
      # debugging
      proto.verbosity = self.verbosity
      proto.showEvery = self.showEvery
      proto.seed = self.seed
docs: Writes serialized data to proto object
  
      :param proto: (DynamicStructBuilder) Proto object