title: calculating the neighbours of an element in tensor
body: <p>consider i I thave the following tensor</p>
  
  <pre><code>r = 8
  c = 12
  n = 2
  a = np.arange(0, 96)
  o = tf.ones([(n*2)+1, (n*2)+1], tf.int32)
  m = tf.constant(a, tf.int32, [r,c])
  
  [[ 0  1  2  3  4  5  6  7  8  9 10 11]
   [12 13 14 15 16 17 18 19 20 21 22 23]
   [24 25 26 27 28 29 30 31 32 33 34 35]
   [36 37 38 39 40 41 42 43 44 45 46 47]
   [48 49 50 51 52 53 54 55 56 57 58 59]
   [60 61 62 63 64 65 66 67 68 69 70 71]
   [72 73 74 75 76 77 78 79 80 81 82 83]
   [84 85 86 87 88 89 90 91 92 93 94 95]]
  </code></pre>
  
  <p>and </p>
  
  <pre><code>k = tf.slice(m, [n ,n], [r - n*2, c - n*2])
  
  [[26 27 28 29 30 31 32 33]
   [38 39 40 41 42 43 44 45]
   [50 51 52 53 54 55 56 57]
   [62 63 64 65 66 67 68 69]]
  </code></pre>
  
  <p>for each element in 'k' i want to get the neighbours which is 'n' distance away. </p>
  
  <p>for example</p>
  
  <p>for '26' I want the following tensor </p>
  
  <pre><code>[[ 0  1  2  3  4 ]
   [12 00 00 00 16 ]
   [24 00 00 00 28 ]
   [36 00 00 00 40 ]
   [48 49 50 51 52]]
  </code></pre>
  
  <p>in 1D it would be </p>
  
  <blockquote>
    <p>[0,1,2,3,4,12,16,24, 28, 36, 40, 48,49,50,51,52]</p>
  </blockquote>
  
  <p>Thanks in advance!</p>