def pow(data, exponent, axis=None, broadcast=None): if not broadcast and data.shape.dims != exponent.shape.dims: raise tile.LogicError('Incompatible shapes in power') if broadcast and (axis is not None): exponent = op.reshape( exponent, list(exponent.shape.dims) + ([1] * (data.shape.ndims - exponent.shape.ndims - axis))) return (op.pow(data, exponent), )
def lrn(data, alpha, beta, size, bias=1.): local_sums = LocalChannelSum.function(data * data, size) return (data / op.pow(bias + ((alpha / size) * local_sums), beta), )