def testFree(self): sampleData = numpy.indices((100, 200, 150), dtype=numpy.float32).sum(0) sampleData = vigra.taggedView(sampleData, axistags='xyz') graph = Graph() opData = OpArrayPiperWithAccessCount(graph=graph) opData.Input.setValue(sampleData) op = OpCompressedCache(graph=graph) #logger.debug("Setting block shape...") op.BlockShape.setValue([100, 75, 50]) op.Input.connect(opData.Output) op.Output[...].wait() mem = op.usedMemory() keys = [x[0] for x in op.getBlockAccessTimes()] key = keys[0] op.freeBlock(key) assert op.usedMemory() < mem
def testFree(self): sampleData = numpy.indices((100, 200, 150), dtype=numpy.float32).sum(0) sampleData = vigra.taggedView(sampleData, axistags='xyz') graph = Graph() opData = OpArrayPiperWithAccessCount(graph=graph) opData.Input.setValue(sampleData) op = OpCompressedCache(graph=graph) #logger.debug("Setting block shape...") op.BlockShape.setValue([100, 75, 50]) op.Input.connect(opData.Output) op.Output[...].wait() mem = op.usedMemory() keys = map(lambda x: x[0], op.getBlockAccessTimes()) key = keys[0] op.freeBlock(key) assert op.usedMemory() < mem