2014-11-05 2 views

답변

1

여기에 joblib 코드의 중요한 부분이 있습니다. 기본적

def _write_array(self, array, filename): 
    if not self.compress: 
     self.np.save(filename, array) 
     container = NDArrayWrapper(os.path.basename(filename), 
            type(array)) 
    else: 
     filename += '.z' 
     # Efficient compressed storage: 
     # The meta data is stored in the container, and the core 
     # numerics in a z-file 
     _, init_args, state = array.__reduce__() 
     # the last entry of 'state' is the data itself 
     zfile = open(filename, 'wb') 
     write_zfile(zfile, state[-1], 
          compress=self.compress) 
     zfile.close() 
     state = state[:-1] 
     container = ZNDArrayWrapper(os.path.basename(filename), 
             init_args, state) 
    return container, filename 

, joblib.dump 임의로 numpy.save와 디스크 어레이, 그것은 어느 점포를 압축하거나, (압축)는 압축 파일을 저장한다. 또한 joblib.dump은 압축 내용으로 NDArrayWrapper (또는 ZNDArrayWrapper)을 저장합니다.이 내용은 저장 내용/저장 파일의 이름과 배열의 하위 클래스를 저장하는 간단한 개체입니다.

관련 문제