tf.nn.l2_loss
别名
tf.compat.v1.nn.l2_loss
1.功能
tf.nn.l2_loss计算L2损失。
o
u
t
=
∑
t
i
2
2
out = \frac{\sum{t^2_i }} 2
out=2∑ti2
2.入参
tf.nn.l2_loss(
t, name=None
)
参数 | 含义 |
---|
t | 元素类型是half, bfloat16, float32, float64之一的张量. |
name | 操作的别名(可选). |
3.返回值
输出 output = sum(t ** 2) / 2
示例
![在这里插入图片描述](https://img-blog.csdnimg.cn/20200825144533521.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0FjY2VsZXJhdGluZw==,size_16,color_FFFFFF,t_70#pic_center)