ggml_layer_max_pooling_2d: Add 2D Max Pooling Layer

View source: R/nn_layers.R

ggml_layer_max_pooling_2dR Documentation

Add 2D Max Pooling Layer

Description

Add 2D Max Pooling Layer

Usage

ggml_layer_max_pooling_2d(
  model,
  pool_size = c(2L, 2L),
  strides = NULL,
  name = NULL,
  trainable = TRUE
)

Arguments

model

A ggml_sequential_model object

pool_size

Integer or vector of 2 integers for pool height and width

strides

Integer or vector of 2 integers (defaults to pool_size)

name

Optional character name for the layer.

trainable

Logical; reserved for API consistency (no weights).

Value

The model object with the max pooling layer appended (invisibly).

Examples


model <- ggml_model_sequential() |>
  ggml_layer_conv_2d(32, c(3,3), activation = "relu",
                     input_shape = c(28, 28, 1)) |>
  ggml_layer_max_pooling_2d(c(2, 2))


ggmlR documentation built on July 14, 2026, 1:08 a.m.