def test_constant_from_integer_array(val_type, range_start, range_end): np.random.seed(133391) input_data = np.array( np.random.randint(range_start, range_end, size=(2, 2)), dtype=val_type ) result = run_op_numeric_data(input_data, ng.constant, val_type) assert np.allclose(result, input_data)
def test_constant_from_float_array(val_type): np.random.seed(133391) input_data = np.array(-1 + np.random.rand(2, 3, 4) * 2, dtype=val_type) result = run_op_numeric_data(input_data, ng.constant, val_type) assert np.allclose(result, input_data)
def test_constant_from_scalar(val_type, value): expected = np.array(value, dtype=val_type) result = run_op_numeric_data(value, ng.constant, val_type) assert np.allclose(result, expected)