def engine(self, new_engine): '''Reset the calculating library (DaPy or Numpy)''' if is_str(new_engine): new_engine = str2eng(new_engine) for func in ('abs', 'dot', 'multiply', 'mean', 'log', 'sum', 'exp'): assert hasattr(new_engine, func), "Your engine does't have attribute %s" % func self._engine = new_engine if hasattr(self, '_activator'): self._activator.engine = self._engine
def _check_addr(self, addr, mode): if is_str(addr): return open(addr, mode) return addr