Contents

namespace

SushiBLAS::Spatial

Declared in
include/SushiBLAS/engine/spatial/window.hpp

Contains

Functions

void require_valid_geometry(const ConvGeometry &g, const char *name)

Throws unless every kernel, stride and dilation is positive and no padding is negative.

Exceptions

std::invalid_argument

naming the first field that breaks the rule.

See also

include/SushiBLAS/engine/spatial/README.md

constexpr bool window_has_live_tap(int64_t origin, int64_t dilation, int64_t kernel, int64_t in) noexcept

Returns true when a window whose first tap sits at origin has a tap inside [0, in).

Precondition

origin < in, dilation > 0, kernel > 0.

void require_live_windows(int64_t in, int64_t out, int64_t pad, int64_t dilation, int64_t kernel, int64_t stride, const char *axis, const char *name)

Throws unless every window along one axis has at least one in-bounds tap.

Exceptions

std::invalid_argument

naming the first window made only of padding.

See also

include/SushiBLAS/engine/spatial/README.md

WindowSpan window_span_for(const Tensor &in, const ConvGeometry &g, int64_t out_h, int64_t out_w, const char *name)

Describes a windowed operation whose output extents the caller states.

Returns

The span in element counts; the out_*_stride fields stay zero.

Exceptions

std::invalid_argument

on a bad geometry or an output extent below 1.

std::runtime_error

when in is not rank 4 or a window origin falls outside the padded input.

See also

include/SushiBLAS/engine/spatial/README.md

WindowSpan window_span_for(const Tensor &in, const ConvGeometry &g, const Tensor &out, const char *name)

Describes a windowed operation from its two rank-4 NHWC operands.

Returns

The span in element counts, with both operands' strides filled in.

Exceptions

std::runtime_error

on a rank other than 4, a batch or channel mismatch, or a bad origin.

See also

include/SushiBLAS/engine/spatial/README.md

WindowSpan pooling_span_for(const Tensor &in, const ConvGeometry &g, const Tensor &out, const char *name)

Describes a pooling operation from its two operands and refuses all-padding windows.

Returns

The span window_span_for returns.

Exceptions

std::invalid_argument

when some window holds only padding, or as window_span_for.

See also

include/SushiBLAS/engine/spatial/README.md

ColumnSpan column_span_for(const Tensor &cols, const WindowSpan &span, const char *name)

Describes an im2col matrix's addressing and checks its extents.

Exceptions

std::runtime_error

when cols is not rank 2 or not span.windows() by span.patch_elements().

constexpr int64_t output_extent(int64_t in, int64_t pad_before, int64_t pad_after, int64_t dilation, int64_t kernel, int64_t stride) noexcept

Returns how many windows fit along one axis, or 0 when none fits.

Parameters

pad_before

Implicit zeros before index 0.

pad_after

Implicit zeros after the last index.

dilation

Spacing between taps; 1 for an undilated window.

See also

include/SushiBLAS/support/README.md