ExpandDims

  • namespace: Rindow\NeuralNetworks\Layer
  • classname: ExpandDims

Extends the specified dimension of the input. This layer only transforms the shape of the input data. It does not affect the batch size.

ExpandDims implements the operation:

  • If axis == 0
  • then output := input->reshape(batchSize, 1, inputSize)
  • If axis == 1
  • then output := input->reshape(batchSize, inputFirstDim, 1, inputOtherDims)
  • If axis == -1
  • then output := input->reshape(batchSize, inputSize, 1)

Methods

constructor

$builer->ExpandDims(
    int $axis,
    array $input_shape=null,
    string $name=null,
)

You can create a ExpandDims layer instances with the Layer Builder.

Options

  • input_shape: Tell the first layer the shape of the input data. In input_shape, the batch dimension is not included.

Examples

$model->add($nn->layers()->ExpandDims(
    -1,
    input_shape:[28,28,3],
));