text: # Copyright (c) 2017 Sony Corporation. All Rights Reserved.
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  
  import pytest
  
  
  import nnabla as nn
  import nnabla.initializer as I
  import nnabla.functions as F
  import nnabla.parametric_functions as PF
  
  from function_benchmark import FunctionBenchmark, Inspec
  
  
  def inspecs_params():
      inspecs = []
      inspecs.append([Inspec((64, 64, 224, 224))])
      inspecs.append([Inspec((64, 128, 112, 112))])
      inspecs.append([Inspec((64, 512, 14, 14))])
      return inspecs
  
  
  @pytest.mark.parametrize('inspecs', inspecs_params())
  @pytest.mark.parametrize('activation',
                           ['identity', 'sigmoid', 'tanh', 'relu', 'elu', 'crelu'])
  def test_activation(inspecs, activation, nnabla_opts):
      func = getattr(F, activation)
      fb = FunctionBenchmark(
          func, inspecs, [], {},
          nnabla_opts.ext, nnabla_opts.ext_kwargs)
      fb.benchmark()
      fb.write(writer=nnabla_opts.function_benchmark_writer)
  