问题
Basically I have a 2d array and I want to do this nice numpy-like thing
noise_spec[:rows,:cols]
in Tensorflow. Here rows and cols are just two integers.
回答1:
Indeed, TensorFlow now has better support for slicing, so you can use the exact same syntax as NumPy:
result = noise_spec[:rows, :cols]
回答2:
found out, it's
tf.slice(noise_spec, [0,0],[rows, cols])
来源:https://stackoverflow.com/questions/41715511/slicing-a-tensor-by-using-indices-in-tensorflow