Utilities

This package provides some useful functions for diverse purposes, including type hint, image manipulation and computation, etc.

Creating grid

grid(n[, spacing, center, symmetric, broadcast])

Create a len(n)-D evenly spaced grid.

interval(n[, spacing, center, symmetric])

Create a 1D evenly spaced grid.

Image manipulation

crop(image, cropping)

Crop an image with given cropping width.

pad(image, padding[, mode, value])

Pad an image with given padding width.

resize(image, target_size[, mode, value])

Resize an image to given size by padding or cropping around its edges.

partition(image, n_patches[, overlap, ...])

Partition an image into patches, either overlapping or not.

partition_padded(image, n_patches[, ...])

Partition an image into patches, each of which is padded with pixels from neighbouring patches.

merge_patches(patches[, overlap, merge_method])

Merge a set of patches into an image.

External parameters

with_external([func, exclude])

A decorator to mark a method as having external parameters.

ExternalParamMixIn()

Variable hook

Computation

GenericCompute(func[, func_tensor])

Conditional(condition, expr_true, expr_false)

InfinityCond(expr_finite, expr_infinite[, ...])