Skip to content

Avoid using lambda functions as default values for class __init__ #2773

@pbk0

Description

@pbk0

Describe the bug

Please avoid have default values as lambda function. They cause issues with serialization and pickling.
Also theses instances cannot be used with asyncio.
Note that the tensorflow classes do not have this issues and they can safely used with asyncio.

Instead of using lambda as defaults have them as global functions.

Code to reproduce the issue

Please check the code here
Line 238 and Line 312

The scale_fn is lambda function. Can you please define them as global function. Defining it like this creates local functions and thus breaks serialization.

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