dlhdl.layer.sliceLayer
Description
Use sliceLayer
objects to divide the input to the layer into an
equal number of groups along the channel dimension of the image.
Creation
Properties
Groups
— Number of groups to split input features into
2 (default) | positive integer
This property is read-only.
Number of groups to split input features into, specified as a positive integer. The value of this property must be two.
Example: 2
GroupID
— ID of group to pass as output
2 (default) | positive integer
This property is read-only.
ID of group to pass as output, specified as a positive integer. The value of this property must be two.
Example: 2
Layer
Name
— Layer name
""
(default) | character vector | string scalar
NumInputs
— Number of inputs
1
(default)
This property is read-only.
Number of inputs to the layer, returned as 1
. This layer accepts a
single input only.
Data Types: double
InputNames
— Input names
{'in'}
(default)
This property is read-only.
Input names, returned as {'in'}
. This layer accepts a single input
only.
Data Types: cell
NumOutputs
— Number of outputs
1
(default)
This property is read-only.
Number of outputs from the layer, returned as 1
. This layer has a
single output only.
Data Types: double
OutputNames
— Output names
{'out'}
(default)
This property is read-only.
Output names, returned as {'out'}
. This layer has a single output
only.
Data Types: cell
Examples
Create Slice Layer
Create a slice layer with the name "slice1"
.
layer = dlhdl.layer.sliceLayer(Name="slice1")
layer = sliceLayer with properties: Name: 'slice1' Groups: 2 GroupId: 2 Learnable Parameters No properties. State Parameters No properties. Show all properties
Include the slice layer in a Layer
array.
iamgeSize = [20 20 16]; layers = [ imageInputLayer(imageSize,"Name","imageinput","Normalization","none") convolution2dLayer(3,16,"Padding","same") dlhdl.layer.sliceLayer(Name="slice",Groups=2,GroupID=2) maxPooling2dLayer(3,'Padding','same','Name','pool')]
layers = 4×1 Layer array with layers: 1 'imageinput' Image Input 20×20×16 images 2 '' 2-D Convolution 16 3×3 convolutions with stride [1 1] and padding 'same' 3 'slice' dlhdl.layer.sliceLayer dlhdl.layer.sliceLayer 4 'pool' 2-D Max Pooling 3×3 max pooling with stride [1 1] and padding 'same'
Algorithms
Slice Layer
A slice layer is a utility layer that slices an input to the layer into a number of
grouped output layers, specified by the Groups
argument, along the
channel dimension and outputs the group specified by the GroupID
argument. For example, if the input to the slice layer is size 10-by-10-by-8 and the number
of groups is two, the slice layer splits the input into two groups of size 10-by-10-by-4,
and if the group ID is two, the second group of size 10-by-10-by-4 is the output of the
slice layer.
Version History
Introduced in R2024a
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)