#include "tensorstore/downsample.h"
template <typename Element, DimensionIndex Rank, ReadWriteMode Mode>
Result<TensorStore<Element, Rank, ReadWriteMode::read>>
tensorstore::Downsample(
    
TensorStore<Element, Rank, Mode> store,
    
std::type_identity_t<span<const Index, Rank>> downsample_factors,
    
DownsampleMethod downsample_method);

Returns a downsampled view of a TensorStore.

Parameters:
TensorStore<Element, Rank, Mode> store

Base view to downsample, must support reading.

std::type_identity_t<span<const Index, Rank>> downsample_factors

Factors by which to downsample each dimension of store. Must have length equal to store.rank() and all factors must be positive. Specifying a factor of 1 indicates not to downsample a given dimension. May be specified as a braced list, e.g. Downsample(store, {2, 3}, DownsampleMethod::kMean).

DownsampleMethod downsample_method

The downsampling method.

Returns:

The downsampled view, with the same rank as store but downsampled domain.

Error absl::StatusCode::kInvalidArgument:

if downsample_factors is invalid, or downsample_method is not supported for store.dtype().