Make a set of tests to do relu1.
(options)
| 891 | |
| 892 | @register_make_test_function() |
| 893 | def make_relu1_tests(options): |
| 894 | """Make a set of tests to do relu1.""" |
| 895 | |
| 896 | # Chose a set of parameters |
| 897 | test_parameters = [{ |
| 898 | "input_shape": [[], [1, 1, 1, 1], [1, 3, 4, 3], [3, 15, 14, 3], |
| 899 | [3, 1, 2, 4, 6], [2, 2, 3, 4, 5, 6]], |
| 900 | }] |
| 901 | |
| 902 | def build_graph(parameters): |
| 903 | input_tensor = tf.placeholder( |
| 904 | dtype=tf.float32, name="input", shape=parameters["input_shape"]) |
| 905 | # Note that the following is not supported: |
| 906 | # out = tf.maximum(-1.0, tf.minimum(input_tensor, 1.0)) |
| 907 | out = tf.minimum(1.0, tf.maximum(input_tensor, -1.0)) |
| 908 | return [input_tensor], [out] |
| 909 | |
| 910 | def build_inputs(parameters, sess, inputs, outputs): |
| 911 | input_values = create_tensor_data( |
| 912 | np.float32, parameters["input_shape"], min_value=-3, max_value=10) |
| 913 | return [input_values], sess.run( |
| 914 | outputs, feed_dict=dict(zip(inputs, [input_values]))) |
| 915 | |
| 916 | make_zip_of_tests(options, test_parameters, build_graph, build_inputs) |
| 917 | |
| 918 | |
| 919 | @register_make_test_function() |
nothing calls this directly
no test coverage detected