def _setup(self, x, axes=None):
"""Setup the linear layer.
:param x: Input tensor.
:param axes: Axes. If x is a tensor, the layer will perform tensor dot.
:return: Output tensor.
"""
y = tf.matmul(x, self._w) if axes is None else tf.tensordot(x, self._w, axes=axes)
if self._with_bias:
y += self._b
if self._with_batch_norm:
y = self._batch_norm.setup(y)
return y
评论列表
文章目录