#define TORCH_ASSERT_ONLY_METHOD_OPERATORS #include #include #include #include #include #ifndef AT_PER_OPERATOR_HEADERS #include #else #include #endif #if !AT_MKLDNN_ENABLED() namespace at { namespace native { Tensor& mkldnn_zero_(Tensor& self) { TORCH_CHECK(false, "mkldnn_zero_: ATen not compiled with MKLDNN support"); } } // namespace native } // namespace at #else // AT_MKLDNN_ENABLED #include namespace at { namespace native { Tensor& mkldnn_zero_(Tensor& self) { using Vec = vec::Vectorized; ideep::tensor& x = itensor_from_mkldnn(self); auto n = x.get_nelems(); auto* x_ = static_cast(x.get_data_handle()); parallel_for(0, n, 2048, [x_](int64_t begin, int64_t end) { vec::map( [](Vec /* unused */) { return 0.0; }, x_ + begin, x_ + begin, end - begin); }); return self; } } // namespace native } // namespace at #endif // AT_MKLDNN_ENABLED