Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

#include <cmath>

using Tensor = exec_aten::Tensor;
using executorch::aten::Tensor;
using executorch::runtime::getLeadingDims;
using executorch::runtime::KernelRuntimeContext;

namespace impl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ namespace impl {
namespace reference {
namespace native {

using Tensor = exec_aten::Tensor;
using executorch::aten::Tensor;
using executorch::runtime::getLeadingDims;
using executorch::runtime::KernelRuntimeContext;

void quantized_linear_out(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ namespace impl {
namespace reference {
namespace native {

using Tensor = exec_aten::Tensor;
using executorch::aten::Tensor;
using executorch::runtime::getLeadingDims;
using executorch::runtime::KernelRuntimeContext;

// The quantized matmul. The quantized matmul accumulates in a wider register,
Expand Down
6 changes: 6 additions & 0 deletions kernels/portable/cpu/util/test/broadcast_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ using exec_aten::ScalarType;
using exec_aten::Tensor;
using executorch::runtime::ArrayRef;
using executorch::runtime::testing::TensorFactory;
using torch::executor::broadcast_tensor;
using torch::executor::delinearize_index;
using torch::executor::get_broadcast_target_size;
using torch::executor::linearize_access_indexes;
using torch::executor::tensor_is_broadcastable_to;
using torch::executor::tensors_are_broadcastable_between;

TEST(BroadcastUtilTest, BroadcastTensor) {
TensorFactory<ScalarType::Int> tf;
Expand Down
5 changes: 4 additions & 1 deletion kernels/portable/cpu/util/test/reduce_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ using exec_aten::ArrayRef;
using exec_aten::optional;
using exec_aten::ScalarType;
using exec_aten::Tensor;
using torch::executor::testing::TensorFactory;
using executorch::runtime::testing::TensorFactory;
using torch::executor::apply_over_dim;
using torch::executor::apply_over_dim_list;
using torch::executor::get_out_numel;

void _apply_over_dim(const Tensor& in, const optional<int64_t>& dim) {
int64_t* in_data = in.mutable_data_ptr<int64_t>();
Expand Down
2 changes: 1 addition & 1 deletion kernels/test/custom_kernel_example/my_functions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
- op: relu.out
kernels:
- arg_meta: null
kernel_name: torch::my_custom_kernel::my_relu_out
kernel_name: my_custom_kernels::my_relu_out
16 changes: 8 additions & 8 deletions kernels/test/custom_kernel_example/op_relu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
#include <executorch/runtime/kernel/kernel_includes.h>
#include <executorch/runtime/platform/assert.h>

namespace torch {
namespace my_custom_kernel {
namespace my_custom_kernels {
namespace native {

using Tensor = exec_aten::Tensor;
using ScalarType = exec_aten::ScalarType;
using executor::Error;
using exec_aten::ScalarType;
using exec_aten::Tensor;
using executorch::runtime::Error;
using executorch::runtime::KernelRuntimeContext;
using executorch::runtime::resize_tensor;
using executorch::runtime::tensors_have_same_shape_and_dtype;

namespace {

Expand Down Expand Up @@ -67,7 +68,7 @@ my_relu_out(KernelRuntimeContext& context, const Tensor& input, Tensor& out) {
resize(out, input.sizes());
ET_KERNEL_CHECK(
context,
executor::tensors_have_same_shape_and_dtype(input, out),
tensors_have_same_shape_and_dtype(input, out),
InvalidArgument,
out);

Expand All @@ -94,5 +95,4 @@ my_relu_out(KernelRuntimeContext& context, const Tensor& input, Tensor& out) {
}

} // namespace native
} // namespace my_custom_kernel
} // namespace torch
} // namespace my_custom_kernels
12 changes: 7 additions & 5 deletions kernels/test/op_add_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
#include <iostream>

using namespace ::testing;
using exec_aten::Scalar;
using exec_aten::ScalarType;
using exec_aten::Tensor;
using executorch::aten::Scalar;
using executorch::aten::ScalarType;
using executorch::aten::Tensor;
using executorch::runtime::testing::TensorFactory;
using torch::executor::testing::SupportedFeatures;
using torch::executor::testing::TensorFactory;
namespace etrt = executorch::runtime;

class OpAddOutKernelTest : public OperatorTest {
protected:
Expand Down Expand Up @@ -63,7 +64,8 @@ class OpAddOutKernelTest : public OperatorTest {
test_add<DTYPE_A, DTYPE_B, ScalarType::Float>();
test_add<DTYPE_A, DTYPE_B, ScalarType::Double>();
// Integral out type is only allowed if both inputs are integral types
if (isIntegralType(DTYPE_A, false) && isIntegralType(DTYPE_B, false)) {
if (etrt::isIntegralType(DTYPE_A, false) &&
etrt::isIntegralType(DTYPE_B, false)) {
test_add<DTYPE_A, DTYPE_B, ScalarType::Int>();
test_add<DTYPE_A, DTYPE_B, ScalarType::Long>();
}
Expand Down
12 changes: 7 additions & 5 deletions kernels/test/op_mul_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
#include <gtest/gtest.h>

using namespace ::testing;
using exec_aten::Scalar;
using exec_aten::ScalarType;
using exec_aten::Tensor;
using executorch::aten::Scalar;
using executorch::aten::ScalarType;
using executorch::aten::Tensor;
using executorch::runtime::testing::TensorFactory;
using torch::executor::testing::SupportedFeatures;
using torch::executor::testing::TensorFactory;
namespace etrt = executorch::runtime;

class OpMulOutTest : public OperatorTest {
protected:
Expand Down Expand Up @@ -61,7 +62,8 @@ class OpMulOutTest : public OperatorTest {
test_mul<DTYPE_A, DTYPE_B, ScalarType::Float>();
test_mul<DTYPE_A, DTYPE_B, ScalarType::Double>();
// Integral out type is only allowed if both inputs are integral types
if (isIntegralType(DTYPE_A, false) && isIntegralType(DTYPE_B, false)) {
if (etrt::isIntegralType(DTYPE_A, false) &&
etrt::isIntegralType(DTYPE_B, false)) {
test_mul<DTYPE_A, DTYPE_B, ScalarType::Int>();
test_mul<DTYPE_A, DTYPE_B, ScalarType::Long>();
}
Expand Down
12 changes: 7 additions & 5 deletions kernels/test/op_sub_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
#include <gtest/gtest.h>

using namespace ::testing;
using exec_aten::Scalar;
using exec_aten::ScalarType;
using exec_aten::Tensor;
using executorch::aten::Scalar;
using executorch::aten::ScalarType;
using executorch::aten::Tensor;
using executorch::runtime::testing::TensorFactory;
using torch::executor::testing::SupportedFeatures;
using torch::executor::testing::TensorFactory;
namespace etrt = executorch::runtime;

class OpSubOutTest : public OperatorTest {
protected:
Expand Down Expand Up @@ -60,7 +61,8 @@ class OpSubOutTest : public OperatorTest {
test_sub<DTYPE_A, DTYPE_B, ScalarType::Float>();
test_sub<DTYPE_A, DTYPE_B, ScalarType::Double>();
// Integral out type is only allowed if both inputs are integral types
if (isIntegralType(DTYPE_A, false) && isIntegralType(DTYPE_B, false)) {
if (etrt::isIntegralType(DTYPE_A, false) &&
etrt::isIntegralType(DTYPE_B, false)) {
test_sub<DTYPE_A, DTYPE_B, ScalarType::Int>();
test_sub<DTYPE_A, DTYPE_B, ScalarType::Long>();
}
Expand Down
Loading