Type tf.keras.layers
Namespace tensorflow
Methods
- add
- add
- add_dyn
- average
- average_dyn
- concatenate
- concatenate
- concatenate_dyn
- dot
- dot
- dot_dyn
- maximum
- maximum_dyn
- minimum
- minimum_dyn
- multiply
- multiply_dyn
- serialize
- subtract
- subtract_dyn
Properties
Public static methods
object add(IEnumerable<IGraphNodeBase> inputs, IDictionary<string, object> kwargs)
Functional interface to the `Add` layer.
Parameters
-
IEnumerable<IGraphNodeBase>
inputs - A list of input tensors (at least 2).
-
IDictionary<string, object>
kwargs - Standard layer keyword arguments.
Returns
-
object
- 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) ```
object add(IGraphNodeBase inputs, IDictionary<string, object> kwargs)
Functional interface to the `Add` layer.
Parameters
-
IGraphNodeBase
inputs - A list of input tensors (at least 2).
-
IDictionary<string, object>
kwargs - Standard layer keyword arguments.
Returns
-
object
- 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) ```
object add_dyn(object inputs, IDictionary<string, object> kwargs)
Functional interface to the `Add` layer.
Parameters
-
object
inputs - A list of input tensors (at least 2).
-
IDictionary<string, object>
kwargs - Standard layer keyword arguments.
Returns
-
object
- 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) ```
object average(IEnumerable<object> inputs, IDictionary<string, object> kwargs)
Functional interface to the `Average` layer.
Parameters
-
IEnumerable<object>
inputs - A list of input tensors (at least 2).
-
IDictionary<string, object>
kwargs - Standard layer keyword arguments.
Returns
-
object
- A tensor, the average of the inputs.
object average_dyn(object inputs, IDictionary<string, object> kwargs)
Functional interface to the `Average` layer.
Parameters
-
object
inputs - A list of input tensors (at least 2).
-
IDictionary<string, object>
kwargs - Standard layer keyword arguments.
Returns
-
object
- A tensor, the average of the inputs.
object concatenate(IGraphNodeBase inputs, int axis, IDictionary<string, object> kwargs)
Functional interface to the `Concatenate` layer.
Parameters
-
IGraphNodeBase
inputs - A list of input tensors (at least 2).
-
int
axis - Concatenation axis.
-
IDictionary<string, object>
kwargs - Standard layer keyword arguments.
Returns
-
object
- A tensor, the concatenation of the inputs alongside axis `axis`.
object concatenate(IEnumerable<IGraphNodeBase> inputs, int axis, IDictionary<string, object> kwargs)
Functional interface to the `Concatenate` layer.
Parameters
-
IEnumerable<IGraphNodeBase>
inputs - A list of input tensors (at least 2).
-
int
axis - Concatenation axis.
-
IDictionary<string, object>
kwargs - Standard layer keyword arguments.
Returns
-
object
- A tensor, the concatenation of the inputs alongside axis `axis`.
object concatenate_dyn(object inputs, ImplicitContainer<T> axis, IDictionary<string, object> kwargs)
Functional interface to the `Concatenate` layer.
Parameters
-
object
inputs - A list of input tensors (at least 2).
-
ImplicitContainer<T>
axis - Concatenation axis.
-
IDictionary<string, object>
kwargs - Standard layer keyword arguments.
Returns
-
object
- A tensor, the concatenation of the inputs alongside axis `axis`.
object dot(IEnumerable<object> inputs, int axes, bool normalize, IDictionary<string, object> kwargs)
Functional interface to the `Dot` layer.
Parameters
-
IEnumerable<object>
inputs - A list of input tensors (at least 2).
-
int
axes - Integer or tuple of integers, axis or axes along which to take the dot product.
-
bool
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.
-
IDictionary<string, object>
kwargs - Standard layer keyword arguments.
Returns
-
object
- A tensor, the dot product of the samples from the inputs.
object dot(IEnumerable<object> inputs, ValueTuple<int, object> axes, bool normalize, IDictionary<string, object> kwargs)
Functional interface to the `Dot` layer.
Parameters
-
IEnumerable<object>
inputs - A list of input tensors (at least 2).
-
ValueTuple<int, object>
axes - Integer or tuple of integers, axis or axes along which to take the dot product.
-
bool
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.
-
IDictionary<string, object>
kwargs - Standard layer keyword arguments.
Returns
-
object
- A tensor, the dot product of the samples from the inputs.
object dot_dyn(object inputs, object axes, ImplicitContainer<T> normalize, IDictionary<string, object> kwargs)
Functional interface to the `Dot` layer.
Parameters
-
object
inputs - A list of input tensors (at least 2).
-
object
axes - Integer or tuple of integers, axis or axes along which to take the dot product.
-
ImplicitContainer<T>
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.
-
IDictionary<string, object>
kwargs - Standard layer keyword arguments.
Returns
-
object
- A tensor, the dot product of the samples from the inputs.
object maximum(IEnumerable<object> inputs, IDictionary<string, object> kwargs)
Functional interface to the `Maximum` layer that computes the maximum (element-wise) list of `inputs`.
Parameters
-
IEnumerable<object>
inputs - A list of input tensors (at least 2) of same shape.
-
IDictionary<string, object>
kwargs - Standard layer keyword arguments.
Returns
-
object
- A tensor (of same shape as input tensor) with the element-wise maximum of the inputs.
Show Example
input1 = tf.keras.layers.Input(shape=(16,)) x1 = tf.keras.layers.Dense(8, activation='relu')(input1) #shape=(None, 8) input2 = tf.keras.layers.Input(shape=(32,)) x2 = tf.keras.layers.Dense(8, activation='relu')(input2) #shape=(None, 8) max_inp=tf.keras.layers.maximum([x1,x2]) #shape=(None, 8) out = tf.keras.layers.Dense(4)(max_inp) model = tf.keras.models.Model(inputs=[input1, input2], outputs=out)
object maximum_dyn(object inputs, IDictionary<string, object> kwargs)
Functional interface to the `Maximum` layer that computes the maximum (element-wise) list of `inputs`.
Parameters
-
object
inputs - A list of input tensors (at least 2) of same shape.
-
IDictionary<string, object>
kwargs - Standard layer keyword arguments.
Returns
-
object
- A tensor (of same shape as input tensor) with the element-wise maximum of the inputs.
Show Example
input1 = tf.keras.layers.Input(shape=(16,)) x1 = tf.keras.layers.Dense(8, activation='relu')(input1) #shape=(None, 8) input2 = tf.keras.layers.Input(shape=(32,)) x2 = tf.keras.layers.Dense(8, activation='relu')(input2) #shape=(None, 8) max_inp=tf.keras.layers.maximum([x1,x2]) #shape=(None, 8) out = tf.keras.layers.Dense(4)(max_inp) model = tf.keras.models.Model(inputs=[input1, input2], outputs=out)
object minimum(IEnumerable<object> inputs, IDictionary<string, object> kwargs)
Functional interface to the `Minimum` layer.
Parameters
-
IEnumerable<object>
inputs - A list of input tensors (at least 2).
-
IDictionary<string, object>
kwargs - Standard layer keyword arguments.
Returns
-
object
- A tensor, the element-wise minimum of the inputs.
object minimum_dyn(object inputs, IDictionary<string, object> kwargs)
Functional interface to the `Minimum` layer.
Parameters
-
object
inputs - A list of input tensors (at least 2).
-
IDictionary<string, object>
kwargs - Standard layer keyword arguments.
Returns
-
object
- A tensor, the element-wise minimum of the inputs.
object multiply(IEnumerable<object> inputs, IDictionary<string, object> kwargs)
Functional interface to the `Multiply` layer.
Parameters
-
IEnumerable<object>
inputs - A list of input tensors (at least 2).
-
IDictionary<string, object>
kwargs - Standard layer keyword arguments.
Returns
-
object
- A tensor, the element-wise product of the inputs.
object multiply_dyn(object inputs, IDictionary<string, object> kwargs)
Functional interface to the `Multiply` layer.
Parameters
-
object
inputs - A list of input tensors (at least 2).
-
IDictionary<string, object>
kwargs - Standard layer keyword arguments.
Returns
-
object
- A tensor, the element-wise product of the inputs.
IDictionary<string, object> serialize(Layer layer)
object subtract(IEnumerable<object> inputs, IDictionary<string, object> kwargs)
Functional interface to the `Subtract` layer.
Parameters
-
IEnumerable<object>
inputs - A list of input tensors (exactly 2).
-
IDictionary<string, object>
kwargs - Standard layer keyword arguments.
Returns
-
object
- 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) ```
object subtract_dyn(object inputs, IDictionary<string, object> kwargs)
Functional interface to the `Subtract` layer.
Parameters
-
object
inputs - A list of input tensors (exactly 2).
-
IDictionary<string, object>
kwargs - Standard layer keyword arguments.
Returns
-
object
- 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) ```