def tmDiff2(tm1, tm2, verbosity = <NUM_LIT:0>, relaxSegmentTests =True,<EOL>checkLearn = True, checkStates = True):
<EOL>if sameTMParams(tm1, tm2) == False:<EOL><INDENT>print("<STR_LIT>")<EOL>return False<EOL><DEDENT>tm1Label = "<STR_LIT>" % tm1.__class__.__name__<EOL>tm2Label = "<STR_LIT>" % tm2.__class__.__name__<EOL>result = True<EOL>if checkStates:<EOL><INDENT>if (tm1.infActiveState['<STR_LIT:t>'] != tm2.infActiveState['<STR_LIT:t>']).any():<EOL><INDENT>print('<STR_LIT>', numpy.where(tm1.infActiveState['<STR_LIT:t>'] != tm2.infActiveState['<STR_LIT:t>']))<EOL>result = False<EOL><DEDENT>if (tm1.infPredictedState['<STR_LIT:t>'] - tm2.infPredictedState['<STR_LIT:t>']).any():<EOL><INDENT>print('<STR_LIT>', numpy.where(tm1.infPredictedState['<STR_LIT:t>'] != tm2.infPredictedState['<STR_LIT:t>']))<EOL>result = False<EOL><DEDENT>if checkLearn and (tm1.lrnActiveState['<STR_LIT:t>'] - tm2.lrnActiveState['<STR_LIT:t>']).any():<EOL><INDENT>print('<STR_LIT>', numpy.where(tm1.lrnActiveState['<STR_LIT:t>'] != tm2.lrnActiveState['<STR_LIT:t>']))<EOL>result = False<EOL><DEDENT>if checkLearn and (tm1.lrnPredictedState['<STR_LIT:t>'] - tm2.lrnPredictedState['<STR_LIT:t>']).any():<EOL><INDENT>print('<STR_LIT>', numpy.where(tm1.lrnPredictedState['<STR_LIT:t>'] != tm2.lrnPredictedState['<STR_LIT:t>']))<EOL>result = False<EOL><DEDENT>if checkLearn and abs(tm1.getAvgLearnedSeqLength() - tm2.getAvgLearnedSeqLength()) > <NUM_LIT>:<EOL><INDENT>print("<STR_LIT>", end='<STR_LIT:U+0020>')<EOL>print(tm1.getAvgLearnedSeqLength(), "<STR_LIT>", tm2.getAvgLearnedSeqLength())<EOL>result = False<EOL><DEDENT><DEDENT>if tm1.getNumSegments() != tm2.getNumSegments():<EOL><INDENT>print("<STR_LIT>", tm1.getNumSegments(), tm2.getNumSegments())<EOL>result = False<EOL><DEDENT>if tm1.getNumSynapses() != tm2.getNumSynapses():<EOL><INDENT>print("<STR_LIT>", tm1.getNumSynapses(), tm2.getNumSynapses())<EOL>if verbosity >= <NUM_LIT:3>:<EOL><INDENT>print("<STR_LIT>" % tm1Label, end='<STR_LIT:U+0020>')<EOL>tm1.printCells()<EOL>print("<STR_LIT>" % tm2Label, end='<STR_LIT:U+0020>')<EOL>tm2.printCells()<EOL><DEDENT><DEDENT>for c in range(tm1.numberOfCols):<EOL><INDENT>for i in range(tm2.cellsPerColumn):<EOL><INDENT>if tm1.getNumSegmentsInCell(c, i) != tm2.getNumSegmentsInCell(c, i):<EOL><INDENT>print("<STR_LIT>",c,i, end='<STR_LIT:U+0020>')<EOL>print(tm1.getNumSegmentsInCell(c, i), tm2.getNumSegmentsInCell(c, i))<EOL>result = False<EOL><DEDENT><DEDENT><DEDENT>if result == True and not relaxSegmentTests and checkLearn:<EOL><INDENT>for c in range(tm1.numberOfCols):<EOL><INDENT>for i in range(tm2.cellsPerColumn):<EOL><INDENT>nSegs = tm1.getNumSegmentsInCell(c, i)<EOL>for segIdx in range(nSegs):<EOL><INDENT>tm1seg = tm1.getSegmentOnCell(c, i, segIdx)<EOL>res = False<EOL>for tm2segIdx in range(nSegs):<EOL><INDENT>tm2seg = tm2.getSegmentOnCell(c, i, tm2segIdx)<EOL>if sameSegment(tm1seg, tm2seg) == True:<EOL><INDENT>res = True<EOL>break<EOL><DEDENT><DEDENT>if res == False:<EOL><INDENT>print("<STR_LIT>",c,i)<EOL>result = False<EOL>if verbosity >= <NUM_LIT:0>:<EOL><INDENT>print("<STR_LIT>" % tm1Label, end='<STR_LIT:U+0020>')<EOL>tm1.printCell(c, i)<EOL>print("<STR_LIT>" % tm2Label, end='<STR_LIT:U+0020>')<EOL>tm2.printCell(c, i)<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>if result == True and (verbosity > <NUM_LIT:1>):<EOL><INDENT>print("<STR_LIT>")<EOL><DEDENT>return result<EOL>
Given two TM instances, list the difference between them and returns False
if there is a difference. This function checks the major parameters. If this
passes (and checkLearn is true) it checks the number of segments on each cell.
If this passes, checks each synapse on each segment.
When comparing C++ and Py, the segments are usually in different orders in the
cells. tmDiff ignores segment order when comparing TM's.

If checkLearn is True, will check learn states as well as all the segments

If checkStates is True, will check the various state arrays