MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _fspecial_gauss

Function _fspecial_gauss

tensorflow/python/ops/image_ops_impl.py:3207–3221  ·  view source on GitHub ↗

Function to mimic the 'fspecial' gaussian MATLAB function.

(size, sigma)

Source from the content-addressed store, hash-verified

3205
3206
3207def _fspecial_gauss(size, sigma):
3208 """Function to mimic the 'fspecial' gaussian MATLAB function."""
3209 size = ops.convert_to_tensor(size, dtypes.int32)
3210 sigma = ops.convert_to_tensor(sigma)
3211
3212 coords = math_ops.cast(math_ops.range(size), sigma.dtype)
3213 coords -= math_ops.cast(size - 1, sigma.dtype) / 2.0
3214
3215 g = math_ops.square(coords)
3216 g *= -0.5 / math_ops.square(sigma)
3217
3218 g = array_ops.reshape(g, shape=[1, -1]) + array_ops.reshape(g, shape=[-1, 1])
3219 g = array_ops.reshape(g, shape=[1, -1]) # For tf.nn.softmax().
3220 g = nn_ops.softmax(g)
3221 return array_ops.reshape(g, shape=[size, size, 1, 1])
3222
3223
3224def _ssim_per_channel(img1,

Callers 1

_ssim_per_channelFunction · 0.85

Calls 5

reshapeMethod · 0.80
softmaxMethod · 0.80
castMethod · 0.45
rangeMethod · 0.45
squareMethod · 0.45

Tested by

no test coverage detected