Realm

oa::ml::matrix::adaptive_max_pool_1d

Adaptively max-pool an NCL Matrix to exactly output_length elements. Each output window covers the [floor(i*L/out), ceil((i+1)*L/out)) source bin, matching nn.AdaptiveMaxPool1d. The returned record carries the pooled output and the flat input index each bin selected; retaining indices is required for reverse-mode gradients. Errors Returns an error unless input is a nonempty rank-three F32 Matrix and output_length is nonzero, or runtime recording fails.

FnRust public API

Function Documentation

pub fn adaptive_max_pool_1d( input: &Matrix, output_length: usize ) -> Result<AdaptiveMaxPool1dResult>
Adaptively max-pool an NCL Matrix to exactly output_length elements. Each output window covers the [floor(i*L/out), ceil((i+1)*L/out)) source bin, matching nn.AdaptiveMaxPool1d. The returned record carries the pooled output and the flat input index each bin selected; retaining indices is required for reverse-mode gradients. Errors Returns an error unless input is a nonempty rank-three F32 Matrix and output_length is nonzero, or runtime recording fails.