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

Method _LRN

tensorflow/python/kernel_tests/lrn_op_test.py:38–55  ·  view source on GitHub ↗

Compute expected result.

(self, input_image, lrn_depth_radius=5, bias=1.0, alpha=1.0,
           beta=0.5)

Source from the content-addressed store, hash-verified

36class LRNOpTest(test.TestCase):
37
38 def _LRN(self, input_image, lrn_depth_radius=5, bias=1.0, alpha=1.0,
39 beta=0.5):
40 """Compute expected result."""
41 output = copy.deepcopy(input_image)
42 batch_size = input_image.shape[0]
43 rows = input_image.shape[1]
44 cols = input_image.shape[2]
45 depth = input_image.shape[3]
46 for b in range(batch_size):
47 for r in range(rows):
48 for c in range(cols):
49 for d in range(depth):
50 begin = max(0, d - lrn_depth_radius)
51 end = min(depth, d + lrn_depth_radius + 1)
52 patch = input_image[b, r, c, begin:end]
53 output[b, r, c, d] /= (
54 np.power(bias + alpha * np.sum(patch * patch), beta))
55 return output
56
57 def _RunAndVerify(self, dtype):
58 with self.cached_session(use_gpu=True):

Callers 1

_RunAndVerifyMethod · 0.95

Calls 5

powerMethod · 0.80
rangeFunction · 0.50
maxFunction · 0.50
minFunction · 0.50
sumMethod · 0.45

Tested by

no test coverage detected