Example #1
0
def test_reduction_axis(inspecs, reduction, axis, nnabla_opts):
    func = getattr(F, reduction)
    fb = FunctionBenchmark(
        func, inspecs, [], dict(axis=axis),
        nnabla_opts.ext, nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #2
0
def test_binary_classification_loss(inspecs, loss, nnabla_opts):
    func = getattr(F, loss)
    fb = FunctionBenchmark(
        func, inspecs, [], {},
        nnabla_opts.ext, nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #3
0
def test_pairwise_logical(inspecs, op, nnabla_opts):
    func = getattr(F, op)
    fb = FunctionBenchmark(
        func, inspecs, [], {},
        nnabla_opts.ext, nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #4
0
def test_embed(inspecs, n_inputs, n_features, nnabla_opts):
    fb = FunctionBenchmark(
        PF.embed, inspecs, [],
        dict(n_inputs=n_inputs, n_features=n_features),
        nnabla_opts.ext, nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #5
0
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)
Example #6
0
def test_logical_not(inspecs, nnabla_opts):
    func = F.logical_not
    fb = FunctionBenchmark(
        func, inspecs, [], {},
        nnabla_opts.ext, nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #7
0
def test_categorical_classification_loss(inspecs, loss, nnabla_opts):
    func = getattr(F, loss)
    fb = FunctionBenchmark(
        func, inspecs, [], dict(axis=1),
        nnabla_opts.ext, nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #8
0
def test_pooling(inspecs, pool, nnabla_opts):
    if pool == 'average':
        func = F.average_pooling
    elif pool == 'max':
        func = F.max_pooling
    fb = FunctionBenchmark(
        func, inspecs, [], dict(kernel=(2, 2), stride=(2, 2)),
        nnabla_opts.ext, nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
def test_instance_normalization(inspec_and_axis, nnabla_opts):
    inspec, axis = inspec_and_axis
    fb = FunctionBenchmark(PF.instance_normalization, inspec, [],
                           dict(channel_axis=axis), nnabla_opts.ext,
                           nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #10
0
def test_reduction_axis(inspecs, reduction, axis, nnabla_opts):
    func = getattr(F, reduction)
    fb = FunctionBenchmark(
        func, inspecs, [], dict(axis=axis),
        nnabla_opts.ext, nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #11
0
def test_embed(inspecs, n_inputs, n_features, nnabla_opts):
    fb = FunctionBenchmark(
        PF.embed, inspecs, [],
        dict(n_inputs=n_inputs, n_features=n_features),
        nnabla_opts.ext, nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #12
0
def test_pairwise_arithmetic(inspecs, op, nnabla_opts):
    func = getattr(F, op)
    fb = FunctionBenchmark(
        func, inspecs, [], {},
        nnabla_opts.ext, nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #13
0
def test_pooling(inspecs, pool, nnabla_opts):
    if pool == 'average':
        func = F.average_pooling
    elif pool == 'max':
        func = F.max_pooling
    fb = FunctionBenchmark(
        func, inspecs, [], dict(kernel=(2, 2), stride=(2, 2)),
        nnabla_opts.ext, nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #14
0
def test_cumprod(seed, test_case, exclusive, reverse, with_mask, nnabla_opts):
    x_shape = test_case.shape
    axis = test_case.axis

    def init(shape):
        rng = np.random.RandomState(seed)
        return create_cumprod_input(rng, shape, axis, with_mask)

    need_grad = True

    inputs = [Inspec(x_shape, init, need_grad)]

    func_kwargs = dict(
        axis=axis,
        exclusive=exclusive,
        reverse=reverse,
    )
    fb = FunctionBenchmark(F.cumprod, inputs, [], func_kwargs, nnabla_opts.ext,
                           nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #15
0
def test_categorical_classification_loss(inspecs, loss, nnabla_opts):
    func = getattr(F, loss)
    fb = FunctionBenchmark(func, inspecs, [], dict(axis=1), nnabla_opts.ext,
                           nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #16
0
def test_softmax(inspecs, axis, nnabla_opts):
    fb = FunctionBenchmark(F.softmax, inspecs, [], dict(axis=axis),
                           nnabla_opts.ext, nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #17
0
def test_logical_not(inspecs, nnabla_opts):
    func = F.logical_not
    fb = FunctionBenchmark(func, inspecs, [], {}, nnabla_opts.ext,
                           nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #18
0
def test_convolution(inputs, func_kwargs, nnabla_opts):
    fb = FunctionBenchmark(
        PF.convolution, inputs, [], func_kwargs,
        nnabla_opts.ext, nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
def test_bn(inspecs, batch_stat, nnabla_opts):
    fb = FunctionBenchmark(PF.batch_normalization, inspecs, [],
                           dict(batch_stat=batch_stat), nnabla_opts.ext,
                           nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #20
0
def test_scalar_logical(inspecs, op, nnabla_opts):
    func = getattr(F, op)
    fb = FunctionBenchmark(func, inspecs, [1], {}, nnabla_opts.ext,
                           nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #21
0
def test_binary_classification_loss(inspecs, loss, nnabla_opts):
    func = getattr(F, loss)
    fb = FunctionBenchmark(func, inspecs, [], {}, nnabla_opts.ext,
                           nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #22
0
def test_convolution(inputs, func_kwargs, nnabla_opts):
    fb = FunctionBenchmark(
        PF.convolution, inputs, [], func_kwargs,
        nnabla_opts.ext, nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #23
0
def test_affine(inspecs, n_outmaps, nnabla_opts):
    fb = FunctionBenchmark(PF.affine, inspecs, [], dict(n_outmaps=n_outmaps),
                           nnabla_opts.ext, nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
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)
Example #25
0
def test_bn(inspecs, batch_stat, nnabla_opts):
    fb = FunctionBenchmark(
        PF.batch_normalization, inspecs, [], dict(batch_stat=batch_stat),
        nnabla_opts.ext, nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
def test_layer_normalization(inspec_and_axis, nnabla_opts):
    inspec, axis = inspec_and_axis
    fb = FunctionBenchmark(PF.layer_normalization, inspec, [], dict(),
                           nnabla_opts.ext, nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #27
0
def test_activation(inspecs, shared, nnabla_opts):
    fb = FunctionBenchmark(
        PF.prelu, inspecs, [1], {},
        nnabla_opts.ext, nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #28
0
def test_pad(inspecs, nnabla_opts):
    fb = FunctionBenchmark(F.pad, inspecs, [(10, 10, 10, 10), 'constant', 0.0],
                           {}, nnabla_opts.ext, nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #29
0
def test_activation(inspecs, shared, nnabla_opts):
    fb = FunctionBenchmark(PF.prelu, inspecs, [1], {}, nnabla_opts.ext,
                           nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #30
0
def test_mul2_with_broadcast(inspecs, op, nnabla_opts):
    func = getattr(F, op)
    fb = FunctionBenchmark(func, inspecs, [], {}, nnabla_opts.ext,
                           nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)
Example #31
0
def test_transpose(inspecs, axis, nnabla_opts):
    fb = FunctionBenchmark(F.transpose, inspecs, [axis], dict(),
                           nnabla_opts.ext, nnabla_opts.ext_kwargs)
    fb.benchmark()
    fb.write(writer=nnabla_opts.function_benchmark_writer)