def _linear(self, args, scope="linear"):
out_size = 4 * self._num_units
proj_size = args.get_shape()[-1]
with vs.variable_scope(scope) as scope:
weights = vs.get_variable("weights", [proj_size, out_size])
out = math_ops.matmul(args, weights)
if not self._layer_norm:
bias = vs.get_variable("b", [out_size])
out += bias
return out
评论列表
文章目录