tensor dictionary_shape;
tensor indices_shape;
tensor out_shape;
+ format out_format;
cldnn::gather::gather_axis axis;
data_types data_type;
format input_format;
size_t expected_not_fused_primitives;
};
-#define CASE_GATHER_FP32_1 {2, 3, 1, 4}, {4, 1, 1, 1}, {4, 3, 1, 4}, cldnn::gather::gather_axis::along_b, data_types::f32, format::bfyx, data_types::f32, format::bfyx
-#define CASE_GATHER_FP32_2 {3, 2, 1, 2}, {2, 3, 1, 1}, {2, 3, 2, 2}, cldnn::gather::gather_axis::along_b, data_types::f32, format::bfyx, data_types::f32, format::bfyx
-#define CASE_GATHER_FP32_3 {3, 1, 1, 2}, {2, 1, 1, 1}, {3, 2, 1, 2}, cldnn::gather::gather_axis::along_f, data_types::f32, format::bfyx, data_types::f32, format::bfyx
-#define CASE_GATHER_FP32_4 {5, 3, 2, 2}, {3, 1, 1, 1}, {5, 2, 2, 3}, cldnn::gather::gather_axis::along_y, data_types::f32, format::bfyx, data_types::f32, format::bfyx
-#define CASE_GATHER_FP32_5 {2, 3, 1, 2}, {1, 3, 1, 1}, {2, 3, 3, 1}, cldnn::gather::gather_axis::along_y, data_types::f32, format::bfyx, data_types::f32, format::bfyx
-
-#define CASE_GATHER_FP16_1 {2, 3, 1, 4}, {4, 1, 1, 1}, {4, 3, 1, 4}, cldnn::gather::gather_axis::along_b, data_types::f16, format::bfyx, data_types::f16, format::bfyx
-#define CASE_GATHER_FP16_2 {3, 2, 1, 2}, {2, 3, 1, 1}, {2, 3, 2, 2}, cldnn::gather::gather_axis::along_b, data_types::f16, format::bfyx, data_types::f16, format::bfyx
-#define CASE_GATHER_FP16_3 {3, 1, 1, 2}, {2, 1, 1, 1}, {3, 2, 1, 2}, cldnn::gather::gather_axis::along_f, data_types::f16, format::bfyx, data_types::f16, format::bfyx
-#define CASE_GATHER_FP16_4 {5, 3, 2, 2}, {3, 1, 1, 1}, {5, 2, 2, 3}, cldnn::gather::gather_axis::along_y, data_types::f16, format::bfyx, data_types::f16, format::bfyx
-#define CASE_GATHER_FP16_5 {2, 3, 1, 2}, {1, 3, 1, 1}, {2, 3, 3, 1}, cldnn::gather::gather_axis::along_y, data_types::f16, format::bfyx, data_types::f16, format::bfyx
-
-#define CASE_GATHER_5D_FP32_1 {2, 3, 1, 4, 1}, {4, 1, 1, 1}, {4, 3, 1, 4, 1}, cldnn::gather::gather_axis::along_b, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx
-#define CASE_GATHER_5D_FP32_2 {2, 3, 2, 2, 2}, {2, 1, 1, 1}, {2, 2, 2, 2, 2}, cldnn::gather::gather_axis::along_f, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx
-#define CASE_GATHER_5D_FP32_3 {5, 3, 2, 2, 2}, {3, 1, 1, 1}, {5, 3, 2, 3, 2}, cldnn::gather::gather_axis::along_y, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx
-#define CASE_GATHER_5D_FP32_4 {2, 3, 1, 4, 4}, {2, 1, 1, 1}, {2, 3, 1, 4, 2}, cldnn::gather::gather_axis::along_z, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx
-#define CASE_GATHER_5D_FP32_5 {3, 1, 5, 2, 1}, {2, 1, 1, 1}, {3, 1, 2, 2, 1}, cldnn::gather::gather_axis::along_x, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx
-
-#define CASE_GATHER_5D_FP16_1 {3, 2, 1, 2, 1}, {2, 1, 1, 1}, {2, 2, 2, 2, 1}, cldnn::gather::gather_axis::along_b, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx
-#define CASE_GATHER_5D_FP16_2 {1, 3, 1, 2, 1}, {2, 1, 1, 1}, {1, 2, 1, 2, 1}, cldnn::gather::gather_axis::along_f, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx
-#define CASE_GATHER_5D_FP16_3 {2, 3, 1, 3, 3}, {1, 2, 1, 1}, {2, 3, 1, 2, 3}, cldnn::gather::gather_axis::along_y, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx
-#define CASE_GATHER_5D_FP16_4 {3, 2, 2, 2, 2}, {2, 1, 1, 1}, {3, 2, 2, 2, 2}, cldnn::gather::gather_axis::along_z, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx
-#define CASE_GATHER_5D_FP16_5 {1, 1, 2, 1, 1}, {3, 1, 1, 1}, {1, 1, 3, 1, 1}, cldnn::gather::gather_axis::along_x, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx
+#define CASE_GATHER_FP32_1 {2, 3, 1, 4}, {4, 1, 1, 1}, {4, 3, 1, 4}, format::bfyx, cldnn::gather::gather_axis::along_b, data_types::f32, format::bfyx, data_types::f32, format::bfyx
+#define CASE_GATHER_FP32_2 {3, 2, 1, 2}, {2, 3, 1, 1}, {2, 3, 2, 2}, format::bfyx, cldnn::gather::gather_axis::along_b, data_types::f32, format::bfyx, data_types::f32, format::bfyx
+#define CASE_GATHER_FP32_3 {3, 1, 1, 2}, {2, 1, 1, 1}, {3, 2, 1, 2}, format::bfyx, cldnn::gather::gather_axis::along_f, data_types::f32, format::bfyx, data_types::f32, format::bfyx
+#define CASE_GATHER_FP32_4 {5, 3, 2, 2}, {3, 1, 1, 1}, {5, 2, 2, 3}, format::bfyx, cldnn::gather::gather_axis::along_y, data_types::f32, format::bfyx, data_types::f32, format::bfyx
+#define CASE_GATHER_FP32_5 {2, 3, 1, 2}, {1, 3, 1, 1}, {2, 3, 3, 1}, format::bfyx, cldnn::gather::gather_axis::along_y, data_types::f32, format::bfyx, data_types::f32, format::bfyx
+
+#define CASE_GATHER_FP16_1 {2, 3, 1, 4}, {4, 1, 1, 1}, {4, 3, 1, 4}, format::bfyx, cldnn::gather::gather_axis::along_b, data_types::f16, format::bfyx, data_types::f16, format::bfyx
+#define CASE_GATHER_FP16_2 {3, 2, 1, 2}, {2, 3, 1, 1}, {2, 3, 2, 2}, format::bfyx, cldnn::gather::gather_axis::along_b, data_types::f16, format::bfyx, data_types::f16, format::bfyx
+#define CASE_GATHER_FP16_3 {3, 1, 1, 2}, {2, 1, 1, 1}, {3, 2, 1, 2}, format::bfyx, cldnn::gather::gather_axis::along_f, data_types::f16, format::bfyx, data_types::f16, format::bfyx
+#define CASE_GATHER_FP16_4 {5, 3, 2, 2}, {3, 1, 1, 1}, {5, 2, 2, 3}, format::bfyx, cldnn::gather::gather_axis::along_y, data_types::f16, format::bfyx, data_types::f16, format::bfyx
+#define CASE_GATHER_FP16_5 {2, 3, 1, 2}, {1, 3, 1, 1}, {2, 3, 3, 1}, format::bfyx, cldnn::gather::gather_axis::along_y, data_types::f16, format::bfyx, data_types::f16, format::bfyx
+
+#define CASE_GATHER_5D_FP32_1 {2, 3, 1, 4, 1}, {4, 1, 1, 1}, {4, 3, 1, 4, 1}, format::bfzyx, cldnn::gather::gather_axis::along_b, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx
+#define CASE_GATHER_5D_FP32_2 {2, 3, 2, 2, 2}, {2, 1, 1, 1}, {2, 2, 2, 2, 2}, format::bfzyx, cldnn::gather::gather_axis::along_f, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx
+#define CASE_GATHER_5D_FP32_3 {5, 3, 2, 2, 2}, {3, 1, 1, 1}, {5, 3, 2, 3, 2}, format::bfzyx, cldnn::gather::gather_axis::along_y, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx
+#define CASE_GATHER_5D_FP32_4 {2, 3, 1, 4, 4}, {2, 1, 1, 1}, {2, 3, 1, 4, 2}, format::bfzyx, cldnn::gather::gather_axis::along_z, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx
+#define CASE_GATHER_5D_FP32_5 {3, 1, 5, 2, 1}, {2, 1, 1, 1}, {3, 1, 2, 2, 1}, format::bfzyx, cldnn::gather::gather_axis::along_x, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx
+
+#define CASE_GATHER_5D_FP16_1 {3, 2, 1, 2, 1}, {2, 1, 1, 1}, {2, 2, 2, 2, 1}, format::bfzyx, cldnn::gather::gather_axis::along_b, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx
+#define CASE_GATHER_5D_FP16_2 {1, 3, 1, 2, 1}, {2, 1, 1, 1}, {1, 2, 1, 2, 1}, format::bfzyx, cldnn::gather::gather_axis::along_f, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx
+#define CASE_GATHER_5D_FP16_3 {2, 3, 1, 3, 3}, {1, 2, 1, 1}, {2, 3, 1, 2, 3}, format::bfzyx, cldnn::gather::gather_axis::along_y, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx
+#define CASE_GATHER_5D_FP16_4 {3, 2, 2, 2, 2}, {2, 1, 1, 1}, {3, 2, 2, 2, 2}, format::bfzyx, cldnn::gather::gather_axis::along_z, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx
+#define CASE_GATHER_5D_FP16_5 {1, 1, 2, 1, 1}, {3, 1, 1, 1}, {1, 1, 3, 1, 1}, format::bfzyx, cldnn::gather::gather_axis::along_x, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx
class GatherPrimitiveFusingTest : public ::BaseFusingTest<gather_test_params> {
public:
data("in_hi", get_mem(get_per_channel_layout(p), 1, max_random)),
data("out_lo", get_mem(get_single_element_layout(p), -127)),
data("out_hi", get_mem(get_single_element_layout(p), 127)),
- gather("gather_prim", "input", "gather_indices", p.axis, p.out_shape),
+ gather("gather_prim", "input", "gather_indices", p.axis, p.out_format, p.out_shape),
quantize("quantize", "gather_prim", "in_lo", "in_hi", "out_lo", "out_hi", 255, data_types::i8),
reorder("reorder_bfyx", "quantize", p.default_format, data_types::f32)
);
create_topologies(input_layout("input", get_input_layout(p)),
data("gather_indices", get_mem(get_indices_layout(p), 0, static_cast<int>(get_axis_dim(p)))),
data("scale_data", get_mem(get_per_channel_layout(p), -10, 10)),
- gather("gather_prim", "input", "gather_indices", p.axis, p.out_shape),
+ gather("gather_prim", "input", "gather_indices", p.axis, p.out_format, p.out_shape),
activation("activation", "gather_prim", activation_func::abs),
scale("scale", "activation", "scale_data"),
reorder("reorder_bfyx", "scale", p.default_format, data_types::f32)
topology.add(input_layout("InputDictionary", input1.get_layout()));
topology.add(input_layout("InputText", input2.get_layout()));
topology.add(
- gather("gather", "InputDictionary", "InputText", axis, tensor(1, 4, 1, 2))
+ gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(1, 4, 1, 2))
);
network network(engine, topology);
topology.add(input_layout("InputDictionary", input1.get_layout()));
topology.add(input_layout("InputText", input2.get_layout()));
topology.add(
- gather("gather", "InputDictionary", "InputText", axis, tensor(2, 2, 1, 2, 2))
+ gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 2, 2, 2))
);
network network(engine, topology);
topology.add(input_layout("InputDictionary", input1.get_layout()));
topology.add(input_layout("InputText", input2.get_layout()));
topology.add(
- gather("gather", "InputDictionary", "InputText", axis, tensor(2, 2, 1, 2, 2))
+ gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 2, 2, 2))
);
network network(engine, topology);
topology.add(input_layout("InputDictionary", input1.get_layout()));
topology.add(input_layout("InputText", input2.get_layout()));
topology.add(
- gather("gather", "InputDictionary", "InputText", axis, tensor(2, 2, 2, 1, 2))
+ gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 2, 2, 2))
);
network network(engine, topology);
topology.add(input_layout("InputDictionary", input1.get_layout()));
topology.add(input_layout("InputText", input2.get_layout()));
topology.add(
- gather("gather", "InputDictionary", "InputText", axis, tensor(1, 4, 1, 2))
+ gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(1, 4, 1, 2))
);
network network(engine, topology);
topology.add(input_layout("InputDictionary", input1.get_layout()));
topology.add(input_layout("InputText", input2.get_layout()));
topology.add(
- gather("gather", "InputDictionary", "InputText", axis, tensor(2, 2, 1, 2, 2))
+ gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 2, 2, 2))
);
network network(engine, topology);
topology.add(input_layout("InputDictionary", input1.get_layout()));
topology.add(input_layout("InputText", input2.get_layout()));
topology.add(
- gather("gather", "InputDictionary", "InputText", axis, tensor(2, 2, 1, 2, 2))
+ gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 2, 2, 2))
);
network network(engine, topology);
topology.add(input_layout("InputDictionary", input1.get_layout()));
topology.add(input_layout("InputText", input2.get_layout()));
topology.add(
- gather("gather", "InputDictionary", "InputText", axis, tensor(2, 2, 2, 1, 2))
+ gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 2, 2, 2))
);
network network(engine, topology);
topology.add(input_layout("InputDictionary", input1.get_layout()));
topology.add(input_layout("InputText", input2.get_layout()));
topology.add(
- gather("gather", "InputDictionary", "InputText", axis, tensor(2, 2, 2, 1, 2))
+ gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 2, 2, 2))
);
network network(engine, topology);
topology.add(input_layout("InputDictionary", input1.get_layout()));
topology.add(input_layout("InputText", input2.get_layout()));
topology.add(
- gather("gather", "InputDictionary", "InputText", axis, tensor(1, 4, 1, 2))
+ gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(1, 4, 1, 2))
);
network network(engine, topology);
topology.add(input_layout("InputDictionary", input1.get_layout()));
topology.add(input_layout("InputText", input2.get_layout()));
topology.add(
- gather("gather", "InputDictionary", "InputText", axis, tensor(2, 2, 1, 2, 2))
+ gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 2, 2, 2))
);
network network(engine, topology);
topology.add(input_layout("InputDictionary", input1.get_layout()));
topology.add(input_layout("InputText", input2.get_layout()));
topology.add(
- gather("gather", "InputDictionary", "InputText", axis, tensor(2, 2, 1, 2, 2))
+ gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 2, 2, 2))
);
network network(engine, topology);
topology.add(input_layout("InputDictionary", input1.get_layout()));
topology.add(input_layout("InputText", input2.get_layout()));
topology.add(
- gather("gather", "InputDictionary", "InputText", axis, tensor(4, 1, 3, 2))
+ gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(4, 1, 3, 2))
);
network network(engine, topology);
topology.add(input_layout("InputDictionary", input1.get_layout()));
topology.add(input_layout("InputText", input2.get_layout()));
topology.add(
- gather("gather", "InputDictionary", "InputText", axis, tensor(2, 4, 2, 1))
+ gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 4, 2, 1))
);
network network(engine, topology);
topology.add(input_layout("InputDictionary", input1.get_layout()));
topology.add(input_layout("InputText", input2.get_layout()));
topology.add(
- gather("gather", "InputDictionary", "InputText", axis, tensor(2, 2, 2, 1))
+ gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 2, 2, 1))
);
network network(engine, topology);
EXPECT_EQ(expected_results[i], output_ptr[i]) << " at i=" << i;
}
}
+
+TEST(gather_gpu_fp32, 322_axisF) {
+ // Dictionary : 3x3x1x1
+ // Indexes : 2x2x1x1
+ // Axis : 1
+ // Output : 3x2x2x1
+ // Input values in i32
+
+ engine engine;
+
+ auto input1 = memory::allocate(engine, { data_types::i32, format::bfyx, { 3, 3, 1, 1 } }); // data
+ auto input2 = memory::allocate(engine, { data_types::i32, format::bfyx, { 2, 2, 1, 1 } }); // Indexes
+ auto axis = cldnn::gather::gather_axis::along_f;
+
+ set_values(input1, {
+ 0, 1, 2, 10, 11, 12, 20, 21, 22
+ });
+
+ set_values(input2, {
+ 1, 0,
+ 2, 1
+ });
+
+ topology topology;
+ topology.add(input_layout("InputDictionary", input1.get_layout()));
+ topology.add(input_layout("InputText", input2.get_layout()));
+ topology.add(
+ gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(3, 2, 1, 2))
+ );
+
+ network network(engine, topology);
+
+ network.set_input_data("InputDictionary", input1);
+ network.set_input_data("InputText", input2);
+
+ auto outputs = network.execute();
+
+ auto output = outputs.at("gather").get_memory();
+ auto output_ptr = output.pointer<int>();
+
+ std::vector<int> expected_results = {
+ 1, 0, 2, 1, 11, 10, 12, 11, 21, 20, 22, 21
+ };
+
+ ASSERT_EQ(expected_results.size(), output_ptr.size());
+ for (size_t i = 0; i < expected_results.size(); ++i) {
+ EXPECT_EQ(expected_results[i], output_ptr[i]) << i;
+ }
+}