def close(self):
"""Close the simulation, freeing resources.
Notes
-----
The simulation cannot be restarted after it is closed. This is not a
technical limitation, just a design decision made for all Nengo
simulators.
"""
if not self.closed:
# note: we use getattr in case it crashes before the object is
# created
if getattr(self, "sess", None) is not None:
self.sess.close()
self.sess = None
if getattr(self, "summary", None) is not None:
self.summary.close()
self.closed = True
评论列表
文章目录