class_docstr: Keras test
class_docstr_tok: ["Keras","test"]
docstr: test invalid attribute alpha=None for LeakyReLU and ELU.
  after version 2.3.1 in keras, checking was added to reject the invalid api call:
  LeakyReLU(alpha=None) and ELU(alpha=None),
  (see issue: https://github.com/tensorflow/tensorflow/pull/47017)
  Thus, it's necessary to check the keras version to avoid crash at LeakyReLU(alpha=None)
  and ELU(alpha=None)
docstr_tok: ["test","invalid","attribute","alpha=None","for","LeakyReLU","and","ELU",".","after","version","2.3.1","in","keras",",","checking","was","added","to","reject","the","invalid","api","call",":","LeakyReLU","(","alpha=None",")","and","ELU","(","alpha=None",")",",","(","see","issue",":","https",":","\/\/github.com\/tensorflow\/tensorflow\/pull\/47017",")","Thus",",","it","'s","necessary","to","check","the","keras","version","to","avoid","crash","at","LeakyReLU","(","alpha=None",")","and","ELU","(","alpha=None",")"]
code: def test_forward_activations_except(self, keras_mod):
      """
      test invalid attribute alpha=None for LeakyReLU and ELU.
      after version 2.3.1 in keras, checking was added to reject the invalid api call:
      LeakyReLU(alpha=None) and ELU(alpha=None),
      (see issue: https://github.com/tensorflow/tensorflow/pull/47017)
      Thus, it's necessary to check the keras version to avoid crash at LeakyReLU(alpha=None)
      and ELU(alpha=None)
      """
      if package_version.parse(
          keras_mod.__version__.split("-tf")[0]
      ) <= package_version.parse("2.3.1"):
          act_funcs = [
              keras_mod.layers.LeakyReLU(alpha=None),
              keras_mod.layers.ELU(2, 3, 4),
              keras_mod.layers.ReLU(threshold=None),
          ]
          data = keras_mod.layers.Input(shape=(2, 3, 4))
          for act_func in act_funcs:
              layer = act_func(data)
              keras_model = keras_mod.models.Model(data, layer)
              with pytest.raises(tvm.error.OpAttributeInvalid):
                  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 5 for calling the TestKeras obj's underlying member method code with example usage: obj.test_forward_activations_except(keras_mod) without return types