tf.keras.activations.linear激活函数

介绍

线性回归激活函数

Layer activation 指定

字符串"linear"

例子:

# 其他参数未指定
Conv2D( activation='linear')

语法

tf.keras.activations.linear(
    x
)

源代码

https://github.com/tensorflow/tensorflow/blob/v2.2.0/tensorflow/python/keras/activations.py#L339

def linear(x):
  """Linear activation function.
  For example:
  >>> a = tf.constant([-3.0,-1.0, 0.0,1.0,3.0], dtype = tf.float32)
  >>> b = tf.keras.activations.linear(a)
  >>> b.numpy()
  array([-3., -1.,  0.,  1.,  3.], dtype=float32)
  Arguments:
      x: Input tensor.
  Returns:
      the input unmodified.
  """
  return x

原样输出


原文出处:/show_1EF5aPX550xk.html