def _compute(self, inputs, outputs):
<EOL>if self._tfdr is None:<EOL><INDENT>raise RuntimeError("<STR_LIT>")<EOL><DEDENT>self._conditionalBreak()<EOL>self._iterations += <NUM_LIT:1><EOL>buInputVector = inputs['<STR_LIT>']<EOL>resetSignal = False<EOL>if '<STR_LIT>' in inputs:<EOL><INDENT>assert len(inputs['<STR_LIT>']) == <NUM_LIT:1><EOL>if inputs['<STR_LIT>'][<NUM_LIT:0>] != <NUM_LIT:0>:<EOL><INDENT>self._tfdr.reset()<EOL>self._sequencePos = <NUM_LIT:0>  <EOL><DEDENT><DEDENT>if self.computePredictedActiveCellIndices:<EOL><INDENT>prevPredictedState = self._tfdr.getPredictedState().reshape(-<NUM_LIT:1>).astype('<STR_LIT>')<EOL><DEDENT>if self.anomalyMode:<EOL><INDENT>prevPredictedColumns = self._tfdr.topDownCompute().copy().nonzero()[<NUM_LIT:0>]<EOL><DEDENT>tpOutput = self._tfdr.compute(buInputVector, self.learningMode, self.inferenceMode)<EOL>self._sequencePos += <NUM_LIT:1><EOL>if self.orColumnOutputs:<EOL><INDENT>tpOutput= tpOutput.reshape(self.columnCount,<EOL>self.cellsPerColumn).max(axis=<NUM_LIT:1>)<EOL><DEDENT>if self._fpLogTPOutput:<EOL><INDENT>output = tpOutput.reshape(-<NUM_LIT:1>)<EOL>outputNZ = tpOutput.nonzero()[<NUM_LIT:0>]<EOL>outStr = "<STR_LIT:U+0020>".join(["<STR_LIT>" % int(token) for token in outputNZ])<EOL>print(output.size, outStr, file=self._fpLogTPOutput)<EOL><DEDENT>outputs['<STR_LIT>'][:] = tpOutput.flat<EOL>if self.topDownMode:<EOL><INDENT>outputs['<STR_LIT>'][:] = self._tfdr.topDownCompute().copy()<EOL><DEDENT>if self.anomalyMode:<EOL><INDENT>activeLearnCells = self._tfdr.getLearnActiveStateT()<EOL>size = activeLearnCells.shape[<NUM_LIT:0>] * activeLearnCells.shape[<NUM_LIT:1>]<EOL>outputs['<STR_LIT>'][:] = activeLearnCells.reshape(size)<EOL>activeColumns = buInputVector.nonzero()[<NUM_LIT:0>]<EOL>outputs['<STR_LIT>'][:] = anomaly.computeRawAnomalyScore(<EOL>activeColumns, prevPredictedColumns)<EOL><DEDENT>if self.computePredictedActiveCellIndices:<EOL><INDENT>activeState = self._tfdr._getActiveState().reshape(-<NUM_LIT:1>).astype('<STR_LIT>')<EOL>activeIndices = numpy.where(activeState != <NUM_LIT:0>)[<NUM_LIT:0>]<EOL>predictedIndices= numpy.where(prevPredictedState != <NUM_LIT:0>)[<NUM_LIT:0>]<EOL>predictedActiveIndices = numpy.intersect1d(activeIndices, predictedIndices)<EOL>outputs["<STR_LIT>"].fill(<NUM_LIT:0>)<EOL>outputs["<STR_LIT>"][activeIndices] = <NUM_LIT:1><EOL>outputs["<STR_LIT>"].fill(<NUM_LIT:0>)<EOL>outputs["<STR_LIT>"][predictedActiveIndices] = <NUM_LIT:1><EOL><DEDENT>
Run one iteration of TMRegion's compute