class_docstr: Keras test
class_docstr_tok: ["Keras","test"]
docstr: test_forward_reshape
docstr_tok: ["test_forward_reshape"]
code: def test_forward_reshape(self, keras_mod):
      """test_forward_reshape"""
      # input_shape len is 3, target_shape len is 3
      data = keras_mod.layers.Input(shape=(32, 32, 3))
      x = keras_mod.layers.Reshape(target_shape=(16, 64, 3))(data)
      keras_model = keras_mod.models.Model(data, x)
      verify_keras_frontend(keras_model)
      # input_shape len is 3, target_shape len is 2
      data = keras_mod.layers.Input(shape=(32, 8, 3))
      x = keras_mod.layers.Reshape(target_shape=(256, 3))(data)
      keras_model = keras_mod.models.Model(data, x)
      verify_keras_frontend(keras_model)
      # input_shape len is 2, target_shape len is 3
      data = keras_mod.layers.Input(shape=(256, 3))
      x = keras_mod.layers.Reshape(target_shape=(8, 32, 3))(data)
      keras_model = keras_mod.models.Model(data, x)
      verify_keras_frontend(keras_model)
      # input_shape len is 2, target_shape len is 1
      data = keras_mod.layers.Input(shape=(2, 8))
      x = keras_mod.layers.Reshape(target_shape=(16,))(data)
      keras_model = keras_mod.models.Model(data, x)
      verify_keras_frontend(keras_model, need_transpose=False)
      # input_shape len is 1, target_shape len is 2
      data = keras_mod.layers.Input(shape=(16,))
      x = keras_mod.layers.Reshape(target_shape=(4, 4))(data)
      keras_model = keras_mod.models.Model(data, x)
      verify_keras_frontend(keras_model, need_transpose=False)
      # input_shape len is 2, target_shape len is 2
      data = keras_mod.layers.Input(shape=(2, 8))
      x = keras_mod.layers.Reshape(target_shape=(4, 4))(data)
      keras_model = keras_mod.models.Model(data, x)
      verify_keras_frontend(keras_model, need_transpose=False)
      # "non-square" target shape
      data = keras_mod.layers.Input(shape=(15,))
      x = keras_mod.layers.Reshape(target_shape=(5, 3))(data)
      keras_model = keras_mod.models.Model(data, x)
      verify_keras_frontend(keras_model, need_transpose=False)
      # modify channel dim
      data = keras_mod.layers.Input(shape=(3, 2, 4))
      x = keras_mod.layers.Reshape(target_shape=(3, 8))(data)
      keras_model = keras_mod.models.Model(data, x)
      verify_keras_frontend(keras_model)
  
imports: from packaging import version
  import numpy
  from tensorflow import keras
  import keras
  import pytest
  import tvm
  from tvm import relay
  from tvm.contrib import graph_executor
  import tvm.testing
label_desc: Use image node_id 15 for calling the TestKeras obj's underlying member method code with example usage: obj.test_forward_reshape(keras_mod) without return types