Ejemplo n.º 1
0
  def testNupicTemporalMemoryPickling(self):
    """Test pickling / unpickling of NuPIC TemporalMemory."""

    # Simple test: make sure that dumping / loading works...
    tm = TM(columnDimensions=(16,))

    pickledTm = pickle.dumps(tm)
    tm2 = pickle.loads(pickledTm)

    self.assertEqual(tm.numberOfCells(), tm2.numberOfCells(),
                     "Simple NuPIC TemporalMemory pickle/unpickle failed.")
Ejemplo n.º 2
0
  def testNupicTemporalMemoryPickling(self):
    """Test pickling / unpickling of NuPIC TemporalMemory."""

    # Simple test: make sure that dumping / loading works...
    inputs = SDR( 100 ).randomize( .05 )
    tm = TM( inputs.dimensions)
    for _ in range(10):
      tm.compute( inputs, True)

    pickledTm = pickle.dumps(tm, 2)
    tm2 = pickle.loads(pickledTm)

    self.assertEqual(tm.numberOfCells(), tm2.numberOfCells(),
                     "Simple NuPIC TemporalMemory pickle/unpickle failed.")