The structure of my tf.data.Dataset object is as follow. ((3, 400, 1), (3, 400, 1))
I would like to divide the elements in the 3rd row, of each element by 10. My code is as follows. But it complains as NumPy arrays are immutable
(I'd like to use map
)
def alternate_row (dataset):
xx, yy = [], []
for x, y in dataset.as_numpy_iterator():
x[2] /= 10
y[2] /= 10
xx.append(x)
yy.append(y)
return xx, yy