Skip to content

_static_attr that is stored in _constants throw tracer conversion error #2295

Description

@YigitElma

Another reason to remove constants. If an attribute is set in _static_attr but passed inside constants and used from there as constants['static'], it throws a TracerConversion error during evaluation. For example,

eq = get("precise_QA")
obj = ObjectiveFunction(QuasisymmetryBoozer(eq=eq, surf_batch_size=1))
obj.build()
obj.compute_scaled_error(obj.x(eq))
TracerBoolConversionError: Attempted boolean conversion of traced array with shape bool[].
The error occurred while tracing the function compute_scaled_error at 
/CODES/DESC/desc/objectives/objective_funs.py:1444 for jit. This concrete value was not 
available in Python because it depends on the value of the argument 
self[0]['_constants']['surf_batch_size'].

I think fixing QuasisymmetryBoozer is enough for this issue, but I still wanted to document this problem in general.

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