Мой вопрос: как мне изменить форму тензора!
Вот один синтаксис tf.reshape(tensor, shape, name=None)
tf.reshape(tensor, shape, name=None)
Я не знаю, где я ошибаюсь, но я не могу изменить форму
как я могу это сделать?
спасибо
Попробуйте следующий код:
#assuming `img` contains the data which is in the format (256,256,3) output = tf.reshape(img, [1, 256, 256, 3]) # 1 is batch size
axis=0 # image is your tensor tf.expand_dims(your_image, axis)
Вы можете использовать tf.expand_dims:
tf.expand_dims
output = tf.expand_dims(input, 0)