-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Summary
The Python Grid.dilated_grid() and GridBatch.dilated_grid() methods currently accept a single int dilation value that is applied uniformly to every grid in the batch. The underlying C++ implementation (GridBatchImpl::dilate) already supports a std::vector<int64_t> overload that allows specifying a different dilation amount per grid in the batch.
Motivation
Per-grid dilation amounts would enable use cases where different grids in a batch need different dilation radii -- for example, adaptive resolution workflows or per-object morphological operations in a batched pipeline.
Proposed Change
Extend the Python API so that dilated_grid accepts either:
- A single
int(current behavior, applied to all grids), or - A list/sequence of
intwith one entry per grid in the batch.
This would require:
- Adding or overloading the pybind11 binding in
GridBatchBinding.cppto acceptstd::vector<int64_t>. - Updating
GridBatch.dilated_grid()ingrid_batch.pyandGrid.dilated_grid()ingrid.pyto acceptint | list[int]. - Adding Python-level tests for the per-grid dilation path (including mixed zero/non-zero dilation amounts).
Additional Context
The C++ op dilateGrid in BuildDilatedGrid.cu already handles per-grid dilation correctly, including the edge case where individual dilation amounts are zero.