Skip to content

Commit 431191e

Browse files
committed
add docstrings
1 parent b0ceac8 commit 431191e

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

bioimageio/core/prediction_pipeline/_combined_processing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ def __init__(self, tensor_specs: Union[List[nodes.InputTensor], List[nodes.Outpu
3535
for step in steps:
3636
self._procs.append(KNOWN_PROCESSING[proc_prefix][step.name](tensor_name=t.name, **step.kwargs))
3737

38-
# There is a difference between pre-and-postprocessing:
39-
# Pre-processing always returns float32, because its output is consumed by the model.
40-
# Post-processing, however, should return the dtype that is specified in the model spec.
38+
# There is a difference between pre-and postprocessing:
39+
# Preprocessing always returns float32, because its output is consumed by the model.
40+
# Postprocessing, however, should return the dtype that is specified in the model spec.
4141
# todo: cast dtype for inputs before preprocessing? or check dtype?
4242
if proc_prefix == POST:
4343
for t in tensor_specs:

bioimageio/core/prediction_pipeline/_processing.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ def ensure_dtype(tensor: xr.DataArray, *, dtype) -> xr.DataArray:
103103

104104
@dataclass
105105
class Binarize(Processing):
106+
"""'output = tensor > threshold' (returns float array)
107+
108+
Args:
109+
threshold : threshold.
110+
"""
111+
106112
threshold: float = MISSING # make dataclass inheritance work for py<3.10 by using an explicit MISSING value.
107113

108114
def apply(self, tensor: xr.DataArray) -> xr.DataArray:
@@ -111,6 +117,8 @@ def apply(self, tensor: xr.DataArray) -> xr.DataArray:
111117

112118
@dataclass
113119
class Clip(Processing):
120+
"""Limit tensor values to [min, max]"""
121+
114122
min: float = MISSING
115123
max: float = MISSING
116124

0 commit comments

Comments
 (0)