def compute(self, feedforwardInput=(), lateralInputs=(),
              feedforwardGrowthCandidates=None, learn=True,
              predictedInput = None,):
    if feedforwardGrowthCandidates is None:
      feedforwardGrowthCandidates = feedforwardInput
    if not learn:
      self._computeInferenceMode(feedforwardInput, lateralInputs)
    elif not self.onlineLearning:
      self._computeLearningMode(feedforwardInput, lateralInputs,
                                feedforwardGrowthCandidates)
    else:
      if (predictedInput is not None and
          len(predictedInput) > self.predictedInhibitionThreshold):
        predictedActiveInput = numpy.intersect1d(feedforwardInput,
                                                 predictedInput)
        predictedGrowthCandidates = numpy.intersect1d(
            feedforwardGrowthCandidates, predictedInput)
        self._computeInferenceMode(predictedActiveInput, lateralInputs)
        self._computeLearningMode(predictedActiveInput, lateralInputs,
                                  feedforwardGrowthCandidates)
      elif not self.minSdrSize <= len(self.activeCells) <= self.maxSdrSize:
        self._computeInferenceMode(feedforwardInput, lateralInputs)
        self._computeLearningMode(feedforwardInput, lateralInputs,
                                  feedforwardGrowthCandidates)
      else:
        self._computeLearningMode(feedforwardInput, lateralInputs,
                                  feedforwardGrowthCandidates)