Skip to content

6721 configurable syntax id anchor - #6952

Closed
wyli wants to merge 1 commit into
Project-MONAI:devfrom
wyli:6721-syntax
Closed

wyli wants to merge 1 commit into
Project-MONAI:devfrom
wyli:6721-syntax

Conversation

@wyli

@wyli wyli commented Sep 6, 2023

Copy link
Copy Markdown
Contributor

for #6721

with this PR, it's possible to configure the syntax with a system environment variable MONAI_BUNDLE_SEP="::" then run the following code my_net::spatial_dims:

from monai.bundle import ConfigParser

config = {
    "my_dims": 2,
    "dims_1": "$@my_dims + 1",
    "my_net": {"_target_": "BasicUNet", "spatial_dims": "@dims_1", "in_channels": 1, "out_channels": 4},
}
# in the example $@my_dims + 1 is an expression, which adds 1 to the value of @my_dims
parser = ConfigParser(config)
print(parser.get_parsed_content("my_net::spatial_dims"))  # returns 3

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

Signed-off-by: Wenqi Li <wenqil@nvidia.com>
@wyli
wyli requested review from KumoLiu, Nic-Ma and ericspod September 6, 2023 16:32
@wyli wyli mentioned this pull request Sep 6, 2023
@wyli wyli closed this Sep 6, 2023
@wyli
wyli deleted the 6721-syntax branch September 13, 2023 12:46
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.

1 participant