Skip to content

Conversation

@Vedant2005goyal
Copy link
Contributor

This PR adds missing documentation for the "non_differentiable" attribute to the documentation.

Changes

  • docs/userDocs/source/user/UsingClad.rst: Added a new section "The non_differentiable Attribute" with syntax definitions and three concrete examples (variables, functions, classes).

Verification

  • Built documentation locally using sphinx-build.
  • Verified that formatting and section style are consistent with the rest of the Clad documentation.

@codecov
Copy link

codecov bot commented Nov 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Class type support is under active development and thus, most of these
limitations will be removed soon.

The 'non_differentiable' Attribute
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps we should have non_differentiable in code-format here?

Copy link
Owner

Choose a reason for hiding this comment

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

I'd be even happier if we address this issue #418 before advertising the non-differentiable attribute. I like that syntax ([[clad::non_differentiable]]) a lot better than what we have currently but that's a separate story :)

The 'non_differentiable' Attribute
------------------------------------

Clad allows users to mark specific variables,functions,or members as 'non-differentiable'.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Clad allows users to mark specific variables,functions,or members as 'non-differentiable'.
Clad allows users to mark specific variables, functions, or members as `non-differentiable`.


This feature is useful for:

**Handling Unsupported Types:** You can exclude pointers or legacy types (which are currently listed as limitations in Class differentiation) from the derivative computation.\
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
**Handling Unsupported Types:** You can exclude pointers or legacy types (which are currently listed as limitations in Class differentiation) from the derivative computation.\
**Handling Unsupported Types:** You can exclude pointers or legacy types (which are currently listed as limitations in Class differentiation) from the derivative computation.


.. code-block:: cpp
#define non_differentiable __attribute__((annotate("non_differentiable")))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps Clad should provide this macro to users through the clad header file.

@Vedant2005goyal
Copy link
Contributor Author

Thanks @parth-07 for reviewing the commit.
I have applied all the formatting and grammar fixes you have suggested.

@Vedant2005goyal Vedant2005goyal force-pushed the issue-1271 branch 2 times, most recently from 3d84305 to e9193f1 Compare November 30, 2025 10:09
@Vedant2005goyal
Copy link
Contributor Author

Hi @parth-07,
Just wanted to know if any further changes are required from my side before the PR can be merged.
Thanks!

}
Here, ``df1/dx = 2x`` because the ``f`` contribution is excluded.

Copy link
Owner

Choose a reason for hiding this comment

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

Can we break at the 80 column here as it seems to be the case in the rest of the document?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! I have wrapped the text.

Copy link
Owner

Choose a reason for hiding this comment

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

It does not look like the text was fixed. Did you forget to push?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @vgvassilev
I have double checked the line and the line is within the 80 character limit ,the line splits after the "contribution is".

@Vedant2005goyal Vedant2005goyal force-pushed the issue-1271 branch 3 times, most recently from b52432c to 91a0f4f Compare December 4, 2025 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants