Custom Operations
This example shows how to fuse a small arithmetic expression into one CPU worker using cpu.custom_operation.
Expression
(input - dark) / flat
Files
examples/custom_operations/pipeline.yamlexamples/custom_operations/run_example.py
Run it
python examples/custom_operations/run_example.py
What it demonstrates
custom_operationkernels for small fused workflowsnamed auxiliary streams for expression bindings
a safe restricted expression language
a compact alternative to chaining several simple arithmetic kernels
Supported expression building blocks
elementwise
+,-,*,/unary
+and-matrix multiplication with
@abs,minimum,maximum,min,max, andclipnumeric constants
When to use it
Use a custom-operation kernel when the computation is simple, local, and easier to reason about as one expression than as a longer multi-stage graph.