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
74 changes: 74 additions & 0 deletions kernels/portable/cpu/op_div.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
namespace torch {
namespace executor {
namespace native {
namespace impl {

namespace {

Expand Down Expand Up @@ -279,6 +280,79 @@ Tensor& div_scalar_mode_out(
return out;
}

} // namespace impl

Tensor& div_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Tensor& b,
Tensor& out) {
return impl::div_out(ctx, a, b, out);
}

Tensor& div_out_mode(
KernelRuntimeContext& ctx,
const Tensor& a,
const Tensor& b,
std::optional<std::string_view> mode,
Tensor& out) {
return impl::div_out_mode(ctx, a, b, mode, out);
}

Tensor& div_scalar_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Scalar& b,
Tensor& out) {
return impl::div_scalar_out(ctx, a, b, out);
}

Tensor& div_scalar_mode_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Scalar& b,
std::optional<std::string_view> mode,
Tensor& out) {
return impl::div_scalar_mode_out(ctx, a, b, mode, out);
}

namespace utils {

Tensor& div_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Tensor& b,
Tensor& out) {
return impl::div_out(ctx, a, b, out);
}

Tensor& div_out_mode(
KernelRuntimeContext& ctx,
const Tensor& a,
const Tensor& b,
std::optional<std::string_view> mode,
Tensor& out) {
return impl::div_out_mode(ctx, a, b, mode, out);
}

Tensor& div_scalar_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Scalar& b,
Tensor& out) {
return impl::div_scalar_out(ctx, a, b, out);
}

Tensor& div_scalar_mode_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Scalar& b,
std::optional<std::string_view> mode,
Tensor& out) {
return impl::div_scalar_mode_out(ctx, a, b, mode, out);
}

} // namespace utils
} // namespace native
} // namespace executor
} // namespace torch
50 changes: 50 additions & 0 deletions kernels/portable/cpu/op_div.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/

#include <executorch/runtime/kernel/kernel_includes.h>

#pragma once

namespace torch {
namespace executor {
namespace native {
namespace utils {

using Scalar = executorch::aten::Scalar;
using Tensor = executorch::aten::Tensor;

Tensor& div_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Tensor& b,
Tensor& out);

Tensor& div_out_mode(
KernelRuntimeContext& ctx,
const Tensor& a,
const Tensor& b,
std::optional<std::string_view> mode,
Tensor& out);

Tensor& div_scalar_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Scalar& b,
Tensor& out);

Tensor& div_scalar_mode_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Scalar& b,
std::optional<std::string_view> mode,
Tensor& out);

} // namespace utils
} // namespace native
} // namespace executor
} // namespace torch
38 changes: 38 additions & 0 deletions kernels/portable/cpu/op_eq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
namespace torch {
namespace executor {
namespace native {
namespace impl {

Tensor& eq_tensor_out(
KernelRuntimeContext& ctx,
Expand All @@ -36,6 +37,43 @@ Tensor& eq_scalar_out(
ctx, a, b, out);
}

} // namespace impl

Tensor& eq_tensor_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Tensor& b,
Tensor& out) {
return impl::eq_tensor_out(ctx, a, b, out);
}

Tensor& eq_scalar_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Scalar& b,
Tensor& out) {
return impl::eq_scalar_out(ctx, a, b, out);
}

namespace utils {

Tensor& eq_tensor_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Tensor& b,
Tensor& out) {
return impl::eq_tensor_out(ctx, a, b, out);
}

Tensor& eq_scalar_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Scalar& b,
Tensor& out) {
return impl::eq_scalar_out(ctx, a, b, out);
}

} // namespace utils
} // namespace native
} // namespace executor
} // namespace torch
36 changes: 36 additions & 0 deletions kernels/portable/cpu/op_eq.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/

#include <executorch/runtime/kernel/kernel_includes.h>

#pragma once

namespace torch {
namespace executor {
namespace native {
namespace utils {

using Scalar = executorch::aten::Scalar;
using Tensor = executorch::aten::Tensor;

Tensor& eq_tensor_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Tensor& b,
Tensor& out);

Tensor& eq_scalar_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Scalar& b,
Tensor& out);

} // namespace utils
} // namespace native
} // namespace executor
} // namespace torch
38 changes: 38 additions & 0 deletions kernels/portable/cpu/op_ge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
namespace torch {
namespace executor {
namespace native {
namespace impl {

Tensor& ge_tensor_out(
KernelRuntimeContext& ctx,
Expand All @@ -36,6 +37,43 @@ Tensor& ge_scalar_out(
ctx, a, b, out);
}

} // namespace impl

Tensor& ge_tensor_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Tensor& b,
Tensor& out) {
return impl::ge_tensor_out(ctx, a, b, out);
}

Tensor& ge_scalar_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Scalar& b,
Tensor& out) {
return impl::ge_scalar_out(ctx, a, b, out);
}

namespace utils {

Tensor& ge_tensor_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Tensor& b,
Tensor& out) {
return impl::ge_tensor_out(ctx, a, b, out);
}

Tensor& ge_scalar_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Scalar& b,
Tensor& out) {
return impl::ge_scalar_out(ctx, a, b, out);
}

} // namespace utils
} // namespace native
} // namespace executor
} // namespace torch
36 changes: 36 additions & 0 deletions kernels/portable/cpu/op_ge.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/

#include <executorch/runtime/kernel/kernel_includes.h>

#pragma once

namespace torch {
namespace executor {
namespace native {
namespace utils {

using Scalar = executorch::aten::Scalar;
using Tensor = executorch::aten::Tensor;

Tensor& ge_tensor_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Tensor& b,
Tensor& out);

Tensor& ge_scalar_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Scalar& b,
Tensor& out);

} // namespace utils
} // namespace native
} // namespace executor
} // namespace torch
38 changes: 38 additions & 0 deletions kernels/portable/cpu/op_gt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
namespace torch {
namespace executor {
namespace native {
namespace impl {

Tensor& gt_tensor_out(
KernelRuntimeContext& ctx,
Expand All @@ -34,6 +35,43 @@ Tensor& gt_scalar_out(
return internal::comparison_scalar_out<std::greater, op_name>(ctx, a, b, out);
}

} // namespace impl

Tensor& gt_tensor_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Tensor& b,
Tensor& out) {
return impl::gt_tensor_out(ctx, a, b, out);
}

Tensor& gt_scalar_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Scalar& b,
Tensor& out) {
return impl::gt_scalar_out(ctx, a, b, out);
}

namespace utils {

Tensor& gt_tensor_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Tensor& b,
Tensor& out) {
return impl::gt_tensor_out(ctx, a, b, out);
}

Tensor& gt_scalar_out(
KernelRuntimeContext& ctx,
const Tensor& a,
const Scalar& b,
Tensor& out) {
return impl::gt_scalar_out(ctx, a, b, out);
}

} // namespace utils
} // namespace native
} // namespace executor
} // namespace torch
Loading
Loading