Skip to content

Problem with numpy arrays as step lengths to proximal operators? #1268

Closed
@aringh

Description

@aringh

While working on the Bregman distance functional in #1267 I encountered the following bug:

import odl
import numpy as np

space = odl.uniform_discr(0, 1, 10)
point = space.one()

l2_sq = odl.solvers.L2NormSquared(space)
breg = odl.solvers.BregmanDistance(l2_sq, point)

sigma_array = np.array(0.4)
sigma = float(sigma_array)

tmp = breg.proximal
tmp(sigma)
tmp(sigma_array)

which gives a very short call stack and a cryptical error message.

Traceback (most recent call last):

  File "<ipython-input-4-2907eb4487d1>", line 1, in <module>
    runfile('[...]/tmp.py', wdir='[...]')

  File "[...]/miniconda3/envs/odl-py36/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 880, in runfile
    execfile(filename, namespace)

  File "[...]/miniconda3/envs/odl-py36/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 102, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "[...]/tmp.py", line 15, in <module>
    tmp(sigma_array)

TypeError: unhashable type: 'numpy.ndarray'

Does anyone know what the problem is?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions