Skip to content
Snippets Groups Projects

[Add] Deprecation system

Merged Maxence Naud requested to merge feat_32-deprecation-system into dev

Context

Solves aidge#32 (closed).

To mark a function as deprecated, simply add the MACRO DEPRECATED("new_func_name"); at the beginning where "new_func_name" is the name of the function that should be used instead.

Function name is automatically converted to snake_case if a Python environment is detected.

// in Tensor::setdataFormat()
DEPRECATED("toDataFormat");
>>> import aidge_core as ai
>>> ai.Tensor(dims=[1,2,3,4])
>>> a.set_data_format(ai.dformat.nchw)
[WARNING] - 'set_data_format()' is deprecated, please use 'to_data_format()' instead

Add macro when Python binded function name cannot be automatically deduced DEPRECATED_WITH_PYBIND_OVERRIDES

// in Tensor::setdataFormat()
DEPRECATED_WITH_PYBIND_OVERRIDES("toDataFormat", "set_dformat", "to_dformat");
>>> import aidge_core as ai
>>> ai.Tensor(dims=[1,2,3,4])
>>> a.set_dformat(ai.dformat.nchw)
[WARNING] - 'set_dformat()' is deprecated, please use 'to_dformat()' instead

Major modifications

  • add: utils/Deprecation.hpp
Edited by Maxence Naud

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading