davidhallac / TVGL

53 stars 24 forks source link

TypeError: 'NoneType' object has no attribute '__getitem__' #3

Closed yunxiao47 closed 6 years ago

yunxiao47 commented 6 years ago

Use laplacian penalty function 3 lambda = 2.5, beta = 12 Distributed ADMM (4 processors) Iteration 1 Traceback (most recent call last): File "D:\workplace\eclipse_workplace\TVGL\exampleTVGL.py", line 20, in thetaSet = tvgl.TVGL(data, lengthOfSlice, lamb, beta, indexOfPenalty = 3, verbose=True) File "D:\workplace\eclipse_workplace\TVGL\TVGL.py", line 66, in TVGL gvx.Solve(EpsAbs=epsAbs, EpsRel=epsRel, Verbose = verbose) File "D:\workplace\eclipse_workplace\TVGL\inferGraphLaplacian.py", line 147, in Solve Verbose) File "D:\workplace\eclipse_workplace\TVGL\inferGraphLaplacian.py", line 437, in SolveADMM pool.map(ADMM_x, node_list) File "D:\software\Anaconda2\Lib\multiprocessing\pool.py", line 251, in map return self.map_async(func, iterable, chunksize).get() File "D:\software\Anaconda2\Lib\multiprocessing\pool.py", line 567, in get raise self._value TypeError: 'NoneType' object has no attribute 'getitem__'

I got this error on windows Pycharm, but this script works on Linux Pycharm. However, I got other error on Linux platform.

davidhallac commented 6 years ago

Hmm, can you describe the setup that you're running the code on? Are you by chance running it on Windows?

yunxiao47 commented 6 years ago

@davidhallac Yes,I got the error when running the code on Windows.

davidhallac commented 6 years ago

Unfortunately, TVGL relies on the Multiprocessing package, which does not support Windows. To work around it, the easiest thing to do is to replace these lines of the inferGraph TVGL code:

        pool.map(ADMM_x, node_list)
        pool.map(ADMM_z, edge_list)
        pool.map(ADMM_u, edge_list)

with the following:

        map(ADMM_x, node_list)
        map(ADMM_z, edge_list)
        map(ADMM_u, edge_list)

It won’t be parallelized, but at least it should get the code up and running.