SHARE
TWEET

Untitled

a guest Aug 22nd, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import tensorflow as tf
  2. import numpy as np
  3.  
  4. a = np.array([1, 3, 7, 1, 2, 6, 0, 1])
  5. peaks = a[1:-1][np.diff(np.diff(a)) < 0]
  6.  
  7. peak_values = tf.Variable(np.nonzero(np.in1d(a, peaks))[0])
  8.  
  9. init = tf.global_variables_initializer()
  10.  
  11. with tf.Session() as session:
  12.     session.run(init)
  13.     print('Peaks are at: ', session.run(peak_values))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top