1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375
|
<span style="float:right;">[[source]](https://github.com/keras-team/keras/blob/master/keras/layers/merge.py#L200)</span>
### Add
```python
keras.layers.Add()
```
Layer that adds a list of inputs.
It takes as input a list of tensors,
all of the same shape, and returns
a single tensor (also of the same shape).
__Examples__
```python
import keras
input1 = keras.layers.Input(shape=(16,))
x1 = keras.layers.Dense(8, activation='relu')(input1)
input2 = keras.layers.Input(shape=(32,))
x2 = keras.layers.Dense(8, activation='relu')(input2)
# equivalent to added = keras.layers.add([x1, x2])
added = keras.layers.Add()([x1, x2])
out = keras.layers.Dense(4)(added)
model = keras.models.Model(inputs=[input1, input2], outputs=out)
```
----
<span style="float:right;">[[source]](https://github.com/keras-team/keras/blob/master/keras/layers/merge.py#L231)</span>
### Subtract
```python
keras.layers.Subtract()
```
Layer that subtracts two inputs.
It takes as input a list of tensors of size 2,
both of the same shape, and returns a single tensor, (inputs[0] - inputs[1]),
also of the same shape.
__Examples__
```python
import keras
input1 = keras.layers.Input(shape=(16,))
x1 = keras.layers.Dense(8, activation='relu')(input1)
input2 = keras.layers.Input(shape=(32,))
x2 = keras.layers.Dense(8, activation='relu')(input2)
# Equivalent to subtracted = keras.layers.subtract([x1, x2])
subtracted = keras.layers.Subtract()([x1, x2])
out = keras.layers.Dense(4)(subtracted)
model = keras.models.Model(inputs=[input1, input2], outputs=out)
```
----
<span style="float:right;">[[source]](https://github.com/keras-team/keras/blob/master/keras/layers/merge.py#L268)</span>
### Multiply
```python
keras.layers.Multiply()
```
Layer that multiplies (element-wise) a list of inputs.
It takes as input a list of tensors,
all of the same shape, and returns
a single tensor (also of the same shape).
----
<span style="float:right;">[[source]](https://github.com/keras-team/keras/blob/master/keras/layers/merge.py#L283)</span>
### Average
```python
keras.layers.Average()
```
Layer that averages a list of inputs.
It takes as input a list of tensors,
all of the same shape, and returns
a single tensor (also of the same shape).
----
<span style="float:right;">[[source]](https://github.com/keras-team/keras/blob/master/keras/layers/merge.py#L298)</span>
### Maximum
```python
keras.layers.Maximum()
```
Layer that computes the maximum (element-wise) a list of inputs.
It takes as input a list of tensors,
all of the same shape, and returns
a single tensor (also of the same shape).
----
<span style="float:right;">[[source]](https://github.com/keras-team/keras/blob/master/keras/layers/merge.py#L313)</span>
### Minimum
```python
keras.layers.Minimum()
```
Layer that computes the minimum (element-wise) a list of inputs.
It takes as input a list of tensors,
all of the same shape, and returns
a single tensor (also of the same shape).
----
<span style="float:right;">[[source]](https://github.com/keras-team/keras/blob/master/keras/layers/merge.py#L328)</span>
### Concatenate
```python
keras.layers.Concatenate(axis=-1)
```
Layer that concatenates a list of inputs.
It takes as input a list of tensors,
all of the same shape except for the concatenation axis,
and returns a single tensor, the concatenation of all inputs.
__Arguments__
- __axis__: Axis along which to concatenate.
- __**kwargs__: standard layer keyword arguments.
----
<span style="float:right;">[[source]](https://github.com/keras-team/keras/blob/master/keras/layers/merge.py#L416)</span>
### Dot
```python
keras.layers.Dot(axes, normalize=False)
```
Layer that computes a dot product between samples in two tensors.
E.g. if applied to a list of two tensors `a` and `b` of shape `(batch_size, n)`,
the output will be a tensor of shape `(batch_size, 1)`
where each entry `i` will be the dot product between
`a[i]` and `b[i]`.
__Arguments__
- __axes__: Integer or tuple of integers,
axis or axes along which to take the dot product.
- __normalize__: Whether to L2-normalize samples along the
dot product axis before taking the dot product.
If set to True, then the output of the dot product
is the cosine proximity between the two samples.
- __**kwargs__: Standard layer keyword arguments.
----
### add
```python
keras.layers.add(inputs)
```
Functional interface to the `Add` layer.
__Arguments__
- __inputs__: A list of input tensors (at least 2).
- __**kwargs__: Standard layer keyword arguments.
__Returns__
A tensor, the sum of the inputs.
__Examples__
```python
import keras
input1 = keras.layers.Input(shape=(16,))
x1 = keras.layers.Dense(8, activation='relu')(input1)
input2 = keras.layers.Input(shape=(32,))
x2 = keras.layers.Dense(8, activation='relu')(input2)
added = keras.layers.add([x1, x2])
out = keras.layers.Dense(4)(added)
model = keras.models.Model(inputs=[input1, input2], outputs=out)
```
----
### subtract
```python
keras.layers.subtract(inputs)
```
Functional interface to the `Subtract` layer.
__Arguments__
- __inputs__: A list of input tensors (exactly 2).
- __**kwargs__: Standard layer keyword arguments.
__Returns__
A tensor, the difference of the inputs.
__Examples__
```python
import keras
input1 = keras.layers.Input(shape=(16,))
x1 = keras.layers.Dense(8, activation='relu')(input1)
input2 = keras.layers.Input(shape=(32,))
x2 = keras.layers.Dense(8, activation='relu')(input2)
subtracted = keras.layers.subtract([x1, x2])
out = keras.layers.Dense(4)(subtracted)
model = keras.models.Model(inputs=[input1, input2], outputs=out)
```
----
### multiply
```python
keras.layers.multiply(inputs)
```
Functional interface to the `Multiply` layer.
__Arguments__
- __inputs__: A list of input tensors (at least 2).
- __**kwargs__: Standard layer keyword arguments.
__Returns__
A tensor, the element-wise product of the inputs.
----
### average
```python
keras.layers.average(inputs)
```
Functional interface to the `Average` layer.
__Arguments__
- __inputs__: A list of input tensors (at least 2).
- __**kwargs__: Standard layer keyword arguments.
__Returns__
A tensor, the average of the inputs.
----
### maximum
```python
keras.layers.maximum(inputs)
```
Functional interface to the `Maximum` layer.
__Arguments__
- __inputs__: A list of input tensors (at least 2).
- __**kwargs__: Standard layer keyword arguments.
__Returns__
A tensor, the element-wise maximum of the inputs.
----
### minimum
```python
keras.layers.minimum(inputs)
```
Functional interface to the `Minimum` layer.
__Arguments__
- __inputs__: A list of input tensors (at least 2).
- __**kwargs__: Standard layer keyword arguments.
__Returns__
A tensor, the element-wise minimum of the inputs.
----
### concatenate
```python
keras.layers.concatenate(inputs, axis=-1)
```
Functional interface to the `Concatenate` layer.
__Arguments__
- __inputs__: A list of input tensors (at least 2).
- __axis__: Concatenation axis.
- __**kwargs__: Standard layer keyword arguments.
__Returns__
A tensor, the concatenation of the inputs alongside axis `axis`.
----
### dot
```python
keras.layers.dot(inputs, axes, normalize=False)
```
Functional interface to the `Dot` layer.
__Arguments__
- __inputs__: A list of input tensors (at least 2).
- __axes__: Integer or tuple of integers,
axis or axes along which to take the dot product.
- __normalize__: Whether to L2-normalize samples along the
dot product axis before taking the dot product.
If set to True, then the output of the dot product
is the cosine proximity between the two samples.
- __**kwargs__: Standard layer keyword arguments.
__Returns__
A tensor, the dot product of the samples from the inputs.
|