monai-weekly 1.4.dev2437__py3-none-any.whl → 1.4.dev2439__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. monai/__init__.py +2 -1
  2. monai/_version.py +3 -3
  3. monai/bundle/scripts.py +2 -1
  4. monai/bundle/workflows.py +3 -4
  5. monai/config/__init__.py +0 -1
  6. monai/config/deviceconfig.py +0 -10
  7. monai/data/image_reader.py +1 -1
  8. monai/engines/evaluator.py +2 -2
  9. monai/engines/trainer.py +1 -2
  10. monai/engines/utils.py +1 -2
  11. monai/engines/workflow.py +1 -2
  12. monai/handlers/__init__.py +1 -1
  13. monai/handlers/checkpoint_loader.py +1 -2
  14. monai/handlers/checkpoint_saver.py +1 -2
  15. monai/handlers/classification_saver.py +1 -1
  16. monai/handlers/decollate_batch.py +2 -2
  17. monai/handlers/earlystop_handler.py +1 -2
  18. monai/handlers/garbage_collector.py +1 -2
  19. monai/handlers/ignite_metric.py +1 -24
  20. monai/handlers/logfile_handler.py +1 -2
  21. monai/handlers/lr_schedule_handler.py +1 -2
  22. monai/handlers/metric_logger.py +1 -2
  23. monai/handlers/metrics_saver.py +1 -1
  24. monai/handlers/mlflow_handler.py +1 -2
  25. monai/handlers/nvtx_handlers.py +1 -2
  26. monai/handlers/parameter_scheduler.py +1 -2
  27. monai/handlers/postprocessing.py +1 -2
  28. monai/handlers/probability_maps.py +2 -2
  29. monai/handlers/smartcache_handler.py +1 -2
  30. monai/handlers/stats_handler.py +1 -2
  31. monai/handlers/tensorboard_handlers.py +1 -2
  32. monai/handlers/trt_handler.py +1 -2
  33. monai/handlers/utils.py +2 -2
  34. monai/handlers/validation_handler.py +1 -2
  35. monai/losses/dice.py +1 -16
  36. monai/networks/blocks/patchembedding.py +1 -7
  37. monai/networks/nets/hovernet.py +1 -2
  38. monai/networks/nets/unet.py +0 -3
  39. monai/networks/nets/unetr.py +1 -8
  40. monai/networks/nets/vit.py +0 -8
  41. monai/networks/nets/vitautoenc.py +1 -8
  42. monai/networks/nets/voxelmorph.py +0 -5
  43. monai/transforms/adaptors.py +0 -5
  44. monai/transforms/intensity/array.py +1 -1
  45. monai/transforms/utils.py +2 -1
  46. monai/utils/__init__.py +3 -3
  47. monai/utils/dist.py +1 -1
  48. monai/utils/enums.py +30 -34
  49. monai/utils/jupyter_utils.py +1 -1
  50. monai/utils/misc.py +1 -1
  51. monai/utils/module.py +0 -24
  52. {monai_weekly-1.4.dev2437.dist-info → monai_weekly-1.4.dev2439.dist-info}/METADATA +1 -1
  53. {monai_weekly-1.4.dev2437.dist-info → monai_weekly-1.4.dev2439.dist-info}/RECORD +56 -57
  54. {monai_weekly-1.4.dev2437.dist-info → monai_weekly-1.4.dev2439.dist-info}/WHEEL +1 -1
  55. monai/utils/aliases.py +0 -103
  56. {monai_weekly-1.4.dev2437.dist-info → monai_weekly-1.4.dev2439.dist-info}/LICENSE +0 -0
  57. {monai_weekly-1.4.dev2437.dist-info → monai_weekly-1.4.dev2439.dist-info}/top_level.txt +0 -0
monai/utils/aliases.py DELETED
@@ -1,103 +0,0 @@
1
- # Copyright (c) MONAI Consortium
2
- # Licensed under the Apache License, Version 2.0 (the "License");
3
- # you may not use this file except in compliance with the License.
4
- # You may obtain a copy of the License at
5
- # http://www.apache.org/licenses/LICENSE-2.0
6
- # Unless required by applicable law or agreed to in writing, software
7
- # distributed under the License is distributed on an "AS IS" BASIS,
8
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
- # See the License for the specific language governing permissions and
10
- # limitations under the License.
11
- """
12
- This module is written for configurable workflow, not currently in use.
13
- """
14
-
15
- from __future__ import annotations
16
-
17
- import importlib
18
- import inspect
19
- import sys
20
- import threading
21
-
22
- alias_lock = threading.RLock()
23
- GlobalAliases = {}
24
-
25
- __all__ = ["alias", "resolve_name"]
26
-
27
-
28
- def alias(*names):
29
- """
30
- Stores the decorated function or class in the global aliases table under the given names and as the `__aliases__`
31
- member of the decorated object. This new member will contain all alias names declared for that object.
32
- """
33
-
34
- def _outer(obj):
35
- for n in names:
36
- with alias_lock:
37
- GlobalAliases[n] = obj
38
-
39
- # set the member list __aliases__ to contain the alias names defined by the decorator for `obj`
40
- obj.__aliases__ = getattr(obj, "__aliases__", ()) + tuple(names)
41
-
42
- return obj
43
-
44
- return _outer
45
-
46
-
47
- def resolve_name(name):
48
- """
49
- Search for the declaration (function or class) with the given name. This will first search the list of aliases to
50
- see if it was declared with this aliased name, then search treating `name` as a fully qualified name, then search
51
- the loaded modules for one having a declaration with the given name. If no declaration is found, raise ValueError.
52
-
53
- Raises:
54
- ValueError: When the module is not found.
55
- ValueError: When the module does not have the specified member.
56
- ValueError: When multiple modules with the declaration name are found.
57
- ValueError: When no module with the specified member is found.
58
-
59
- """
60
- # attempt to resolve an alias
61
- with alias_lock:
62
- obj = GlobalAliases.get(name)
63
-
64
- if name in GlobalAliases and obj is None:
65
- raise AssertionError
66
-
67
- # attempt to resolve a qualified name
68
- if obj is None and "." in name:
69
- modname, declname = name.rsplit(".", 1)
70
-
71
- try:
72
- mod = importlib.import_module(modname)
73
- obj = getattr(mod, declname, None)
74
- except ModuleNotFoundError as not_found_err:
75
- raise ValueError(f"Module {modname!r} not found.") from not_found_err
76
-
77
- if obj is None:
78
- raise ValueError(f"Module {modname!r} does not have member {declname!r}.")
79
-
80
- # attempt to resolve a simple name
81
- if obj is None:
82
- # Get all modules having the declaration/import, need to check here that getattr returns something which doesn't
83
- # equate to False since in places __getattr__ returns 0 incorrectly:
84
- # https://github.com/tensorflow/tensorboard/blob/a22566561d2b4fea408755a951ac9eaf3a156f8e/
85
- # tensorboard/compat/tensorflow_stub/pywrap_tensorflow.py#L35
86
- mods = [m for m in list(sys.modules.values()) if getattr(m, name, None)]
87
-
88
- if len(mods) > 0: # found modules with this declaration or import
89
- if len(mods) > 1: # found multiple modules, need to determine if ambiguous or just multiple imports
90
- foundmods = set(filter(None, {inspect.getmodule(getattr(m, name)) for m in mods})) # resolve imports
91
-
92
- if len(foundmods) > 1: # found multiple declarations with the same name
93
- modnames = [m.__name__ for m in foundmods]
94
- msg = f"Multiple modules ({modnames!r}) with declaration name {name!r} found, resolution is ambiguous."
95
- raise ValueError(msg)
96
- mods = list(foundmods)
97
-
98
- obj = getattr(mods[0], name)
99
-
100
- if obj is None:
101
- raise ValueError(f"No module with member {name!r} found.")
102
-
103
- return obj