Пример #1
0
 def input_func():
     inputs = prepare_chainerx_inputs(
         1, config1, True) + prepare_chainerx_inputs(
             1, config2, True)
     result = func(*inputs)
     result.grad = chainerx.ones_like(result)
     return result
Пример #2
0
def test_ones_like_with_device(shape, device):
    t = chainerx.empty((2,), 'float32')
    a = chainerx.ones_like(t, device)
    b = chainerx.ones_like(t)
    array_utils.check_device(a, device)
    chainerx.testing.assert_array_equal_ex(a, b)
Пример #3
0
def test_ones_like_with_device(shape, device):
    t = chainerx.empty((2,), 'float32')
    a = chainerx.ones_like(t, device)
    b = chainerx.ones_like(t)
    array_utils.check_device(a, device)
    chainerx.testing.assert_array_equal_ex(a, b)
Пример #4
0
 def input_func():
     inputs = prepare_chainerx_inputs(num_input, tensor_config,
                                      True)
     result = func(*inputs)
     result.grad = chainerx.ones_like(result)
     return result