Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions kernels/src/kernels/layer/func.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,10 @@ def _create_func_module(func: Callable) -> Type["nn.Module"]:
from torch import nn

class Func(nn.Module):
# Same flags as possible with normal `nn.Module` objects that are exchanged
can_torch_compile = getattr(func, "can_torch_compile", False)
has_backward = getattr(func, "has_backward", True)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took the defaults from the getattr checks so this should be BC

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be documented as well? Otherwise, they feel too specific to me.


def forward(self, *args, **kwargs):
return func(*args, **kwargs)

Expand Down
Loading