code-loader 1.0.60.dev2__py3-none-any.whl → 1.0.62__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.
- code_loader/inner_leap_binder/leapbinder_decorators.py +21 -9
- {code_loader-1.0.60.dev2.dist-info → code_loader-1.0.62.dist-info}/METADATA +1 -1
- {code_loader-1.0.60.dev2.dist-info → code_loader-1.0.62.dist-info}/RECORD +5 -5
- {code_loader-1.0.60.dev2.dist-info → code_loader-1.0.62.dist-info}/LICENSE +0 -0
- {code_loader-1.0.60.dev2.dist-info → code_loader-1.0.62.dist-info}/WHEEL +0 -0
@@ -58,11 +58,13 @@ def tensorleap_custom_metric(name: str, direction: Optional[MetricDirection] = M
|
|
58
58
|
assert isinstance(single_metric_result[0][0], ConfusionMatrixElement), \
|
59
59
|
f'{supported_types_message}Got List[List[{type(single_metric_result[0][0])}]].'
|
60
60
|
else:
|
61
|
-
assert isinstance(single_metric_result[0],
|
61
|
+
assert isinstance(single_metric_result[0],
|
62
|
+
float), f'{supported_types_message}Got List[{type(single_metric_result[0])}].'
|
62
63
|
else:
|
63
|
-
assert isinstance(single_metric_result,
|
64
|
+
assert isinstance(single_metric_result,
|
65
|
+
np.ndarray), f'{supported_types_message}Got {type(single_metric_result)}.'
|
64
66
|
assert len(single_metric_result.shape) == 1, (f'tensorleap_custom_metric validation failed: '
|
65
|
-
|
67
|
+
f'The return shape should be 1D. Got {len(single_metric_result.shape)}D.')
|
66
68
|
|
67
69
|
if leap_binder.batch_size_to_validate:
|
68
70
|
assert len(single_metric_result) == leap_binder.batch_size_to_validate, \
|
@@ -251,7 +253,7 @@ def tensorleap_input_encoder(name: str, channel_dim=-1):
|
|
251
253
|
if input_handler.name == name:
|
252
254
|
raise Exception(f'Input with name {name} already exists. '
|
253
255
|
f'Please choose another')
|
254
|
-
if channel_dim
|
256
|
+
if channel_dim <= 0 and channel_dim != -1:
|
255
257
|
raise Exception(f"Channel dim for input {name} is expected to be either -1 or positive")
|
256
258
|
|
257
259
|
leap_binder.set_input(user_function, name, channel_dim=channel_dim)
|
@@ -276,7 +278,7 @@ def tensorleap_input_encoder(name: str, channel_dim=-1):
|
|
276
278
|
(f'tensorleap_input_encoder validation failed: '
|
277
279
|
f'The return type should be a numpy array of type float32. Got {result.dtype}.')
|
278
280
|
assert channel_dim - 1 <= len(result.shape), (f'tensorleap_input_encoder validation failed: '
|
279
|
-
|
281
|
+
f'The channel_dim ({channel_dim}) should be <= to the rank of the resulting input rank ({len(result.shape)}).')
|
280
282
|
|
281
283
|
def inner(sample_id, preprocess_response):
|
282
284
|
_validate_input_args(sample_id, preprocess_response)
|
@@ -345,11 +347,21 @@ def tensorleap_custom_loss(name: str):
|
|
345
347
|
raise Exception('the input arguments of the custom loss function should be tensorflow tensors') from e
|
346
348
|
|
347
349
|
for i, arg in enumerate(args):
|
348
|
-
|
349
|
-
|
350
|
+
if isinstance(arg, list):
|
351
|
+
for y, elem in enumerate(arg):
|
352
|
+
assert isinstance(elem, tf.Tensor), (f'tensorleap_custom_loss validation failed: '
|
353
|
+
f'Element #{y} of list should be a tensorflow tensor. Got {type(elem)}.')
|
354
|
+
else:
|
355
|
+
assert isinstance(arg, tf.Tensor), (f'tensorleap_custom_loss validation failed: '
|
356
|
+
f'Argument #{i} should be a tensorflow tensor. Got {type(arg)}.')
|
350
357
|
for _arg_name, arg in kwargs.items():
|
351
|
-
|
352
|
-
|
358
|
+
if isinstance(arg, list):
|
359
|
+
for y, elem in enumerate(arg):
|
360
|
+
assert isinstance(elem, tf.Tensor), (f'tensorleap_custom_loss validation failed: '
|
361
|
+
f'Element #{y} of list should be a tensorflow tensor. Got {type(elem)}.')
|
362
|
+
else:
|
363
|
+
assert isinstance(arg, tf.Tensor), (f'tensorleap_custom_loss validation failed: '
|
364
|
+
f'Argument #{_arg_name} should be a tensorflow tensor. Got {type(arg)}.')
|
353
365
|
|
354
366
|
def _validate_result(result):
|
355
367
|
try:
|
@@ -18,12 +18,12 @@ code_loader/experiment_api/utils.py,sha256=XZHtxge12TS4H4-8PjV3sKuhp8Ud6ojAiIzTZ
|
|
18
18
|
code_loader/experiment_api/workingspace_config_utils.py,sha256=DLzXQCg4dgTV_YgaSbeTVzq-2ja_SQw4zi7LXwKL9cY,990
|
19
19
|
code_loader/inner_leap_binder/__init__.py,sha256=koOlJyMNYzGbEsoIbXathSmQ-L38N_pEXH_HvL7beXU,99
|
20
20
|
code_loader/inner_leap_binder/leapbinder.py,sha256=LVzpynjISO-a774flzGt1yAQPsSYNE8B5V58Hacs7bQ,25216
|
21
|
-
code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=
|
21
|
+
code_loader/inner_leap_binder/leapbinder_decorators.py,sha256=AHU88W-UJ5alHOA3pN2oq7lIMiyYWdFSM0BL2WR-FGs,20998
|
22
22
|
code_loader/leaploader.py,sha256=Tpf6A25hYuo4D0umGL3BHNYJhmz_NIwvFveQgAlsSOo,19534
|
23
23
|
code_loader/utils.py,sha256=aw2i_fqW_ADjLB66FWZd9DfpCQ7mPdMyauROC5Nd51I,2197
|
24
24
|
code_loader/visualizers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
25
|
code_loader/visualizers/default_visualizers.py,sha256=VoqO9FN84yXyMjRjHjUTOt2GdTkJRMbHbXJ1cJkREkk,2230
|
26
|
-
code_loader-1.0.
|
27
|
-
code_loader-1.0.
|
28
|
-
code_loader-1.0.
|
29
|
-
code_loader-1.0.
|
26
|
+
code_loader-1.0.62.dist-info/LICENSE,sha256=qIwWjdspQeSMTtnFZBC8MuT-95L02FPvzRUdWFxrwJY,1067
|
27
|
+
code_loader-1.0.62.dist-info/METADATA,sha256=s-UxETRAemR6kd81be7T9OdR7JCIjI4uIXisVRBZORc,888
|
28
|
+
code_loader-1.0.62.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
29
|
+
code_loader-1.0.62.dist-info/RECORD,,
|
File without changes
|
File without changes
|