@@ -218,6 +218,65 @@ EXPECT_TENSOR_EQ(min_indices, tf_long.make(
218218 // clang-format on
219219}
220220
221+ class OpMinUnaryOutTest : public OperatorTest {
222+ protected:
223+ Tensor& op_min_unary_out (
224+ const Tensor& self,
225+ Tensor& out) {
226+ return torch::executor::aten::min_outf (
227+ context_, self, out);
228+ }
229+
230+ template <ScalarType IN_DTYPE>
231+ void test_min_unary_out_dtype () {
232+ TensorFactory<IN_DTYPE> tf_in;
233+ TensorFactory<ScalarType::Float> tf_out;
234+ Tensor input = tf_in.make ({2 , 3 }, {7 , 1 , 3 , 4 , 4 , 2 });
235+ Tensor out = tf_out.zeros ({});
236+ Tensor expected = tf_out.make ({}, {1 });
237+ op_min_unary_out (input, out);
238+ EXPECT_TENSOR_CLOSE (out, expected);
239+ }
240+
241+ template <typename CTYPE, ScalarType IN_DTYPE>
242+ void test_min_unary_out_empty_integer () {
243+ TensorFactory<IN_DTYPE> tf_in;
244+ Tensor input = tf_in.make ({2 , 0 }, {});
245+ Tensor out = tf_in.zeros ({});
246+ Tensor expected = tf_in.make ({}, {std::numeric_limits<CTYPE>::max ()});
247+ op_min_unary_out (input, out);
248+ EXPECT_TENSOR_CLOSE (out, expected);
249+ }
250+
251+ template <typename CTYPE, ScalarType IN_DTYPE>
252+ void test_min_unary_out_empty_floating () {
253+ TensorFactory<IN_DTYPE> tf_in;
254+ Tensor input = tf_in.make ({2 , 0 }, {});
255+ Tensor out = tf_in.zeros ({});
256+ Tensor expected = tf_in.make ({}, {INFINITY});
257+ op_min_unary_out (input, out);
258+ EXPECT_TENSOR_CLOSE (out, expected);
259+ }
260+ };
261+
262+ TEST_F (OpMinUnaryOutTest, AllRealHBF16InputFloatOutputPasses) {
263+ #define TEST_ENTRY (ctype, dtype ) test_min_unary_out_dtype<ScalarType::dtype>();
264+ ET_FORALL_REALHBF16_TYPES (TEST_ENTRY);
265+ #undef TEST_ENTRY
266+ }
267+
268+ TEST_F (OpMinUnaryOutTest, EmptyIntegerInput) {
269+ #define TEST_ENTRY (ctype, dtype ) test_min_unary_out_empty_integer<ctype, ScalarType::dtype>();
270+ ET_FORALL_INT_TYPES (TEST_ENTRY);
271+ #undef TEST_ENTRY
272+ }
273+
274+ TEST_F (OpMinUnaryOutTest, EmptyFloatingInput) {
275+ #define TEST_ENTRY (ctype, dtype ) test_min_unary_out_empty_floating<ctype, ScalarType::dtype>();
276+ ET_FORALL_FLOATHBF16_TYPES (TEST_ENTRY);
277+ #undef TEST_ENTRY
278+ }
279+
221280TEST_F (OpMinOutTest, MismatchedDimensionsDies) {
222281 if (torch::executor::testing::SupportedFeatures::get ()->is_aten ) {
223282 GTEST_SKIP () << " ATen kernel test fails" ;
0 commit comments