diff --git a/docs/source/oneflow.rst b/docs/source/oneflow.rst index 3550065a960..6b257b17ee0 100644 --- a/docs/source/oneflow.rst +++ b/docs/source/oneflow.rst @@ -136,7 +136,7 @@ oneflow selu, silu, slice, - logical_slice, + slice_update, softsign, sort, softplus, diff --git a/oneflow/core/autograd/gradient_funcs/logical_slice.cpp b/oneflow/core/autograd/gradient_funcs/logical_slice.cpp deleted file mode 100644 index ccc06f1cc77..00000000000 --- a/oneflow/core/autograd/gradient_funcs/logical_slice.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* -Copyright 2020 The OneFlow Authors. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -#include "oneflow/core/framework/op_expr_grad_function.h" -#include "oneflow/core/framework/op_builder.h" -#include "oneflow/core/framework/op_interpreter/op_interpreter_util.h" -#include "oneflow/core/framework/op_expr.h" -#include "oneflow/core/functional/functional.h" - -namespace oneflow { -namespace one { - -struct LogicalSliceCaptureState : public AutoGradCaptureState { - Shape like_shape; - std::vector start; - std::vector stop; - std::vector step; - Symbol in_sbp; -}; - -class LogicalSlice : public OpExprGradFunction { - public: - Maybe Init(const OpExpr& op) override { - const auto* fw_op_expr = dynamic_cast(&op); - CHECK_NOTNULL_OR_RETURN(fw_op_expr) << "LogicalSlice op_expr is null"; - base_attrs_ = MakeAttrMapFromUserOpConf(fw_op_expr->proto()); - return Maybe::Ok(); - } - - Maybe Capture(LogicalSliceCaptureState* ctx, const TensorTuple& inputs, - const TensorTuple& outputs, const AttrMap& attrs) const override { - CHECK_EQ_OR_RETURN(inputs.size(), 1) << "LogicalSlice input size must be 1"; - CHECK_EQ_OR_RETURN(outputs.size(), 1) << "LogicalSlice output size must be 1"; - - ComposedAttrMap composed_attrs(attrs, base_attrs_); - ctx->start = JUST(composed_attrs.GetAttr>("start")); - ctx->stop = JUST(composed_attrs.GetAttr>("stop")); - ctx->step = JUST(composed_attrs.GetAttr>("step")); - ctx->like_shape = *(inputs[0]->shape()); - ctx->in_sbp = JUST(inputs[0]->nd_sbp()); - return Maybe::Ok(); - } - - Maybe Apply(const LogicalSliceCaptureState* ctx, const TensorTuple& out_grads, - TensorTuple* in_grads) const override { - in_grads->resize(1); - std::shared_ptr zeros; - if (out_grads[0]->is_local()) { - zeros = JUST(functional::Constant(ctx->like_shape, 0, out_grads[0]->dtype(), - JUST(out_grads[0]->device()))); - } else { - const auto& parallel_desc = JUST(out_grads[0]->parallel_desc()); - zeros = JUST(functional::ConsistentConstant(ctx->like_shape, 0, out_grads[0]->dtype(), - parallel_desc, *JUST(GetSbpList(ctx->in_sbp)))); - } - (*in_grads)[0] = - JUST(functional::LogicalSliceAssign(zeros, out_grads[0], ctx->start, ctx->stop, ctx->step)); - return Maybe::Ok(); - } - - private: - AttrMap base_attrs_; -}; - -struct LogicalSliceAssignCaptureState : public AutoGradCaptureState { - bool requires_grad_ref = false; - bool requires_grad_value = false; - std::vector start; - std::vector stop; - std::vector step; - Shape value_shape; // used to calculate ref gradient - Symbol value_sbp; -}; - -class LogicalSliceAssign : public OpExprGradFunction { - public: - Maybe Init(const OpExpr& op) override { - const auto* fw_op_expr = dynamic_cast(&op); - CHECK_NOTNULL_OR_RETURN(fw_op_expr) << "LogicalSliceAssign op_expr is null"; - - base_attrs_ = MakeAttrMapFromUserOpConf(fw_op_expr->proto()); - return Maybe::Ok(); - } - - Maybe Capture(LogicalSliceAssignCaptureState* ctx, const TensorTuple& inputs, - const TensorTuple& outputs, const AttrMap& attrs) const override { - CHECK_EQ_OR_RETURN(inputs.size(), 2) << "LogicalSliceAssign input size must be 2"; - CHECK_EQ_OR_RETURN(outputs.size(), 1) << "LogicalSliceAssign output size must be 1"; - ctx->requires_grad_ref = inputs[0]->requires_grad(); - ctx->requires_grad_value = inputs[1]->requires_grad(); - if (!ctx->requires_grad_ref && !ctx->requires_grad_value) { return Maybe::Ok(); } - - ComposedAttrMap composed_attrs(attrs, base_attrs_); - ctx->start = JUST(composed_attrs.GetAttr>("start")); - ctx->stop = JUST(composed_attrs.GetAttr>("stop")); - ctx->step = JUST(composed_attrs.GetAttr>("step")); - - if (ctx->requires_grad_ref) { - ctx->value_shape = *(inputs[1]->shape()); - ctx->value_sbp = JUST(inputs[1]->nd_sbp()); - } - return Maybe::Ok(); - } - - Maybe Apply(const LogicalSliceAssignCaptureState* ctx, const TensorTuple& out_grads, - TensorTuple* in_grads) const override { - in_grads->resize(2); - - if (ctx->requires_grad_ref) { - std::shared_ptr zeros; - if (out_grads[0]->is_local()) { - zeros = JUST(functional::Constant(ctx->value_shape, 0, out_grads[0]->dtype(), - JUST(out_grads[0]->device()))); - } else { - const auto& parallel_desc = JUST(out_grads[0]->parallel_desc()); - zeros = - JUST(functional::ConsistentConstant(ctx->value_shape, 0, out_grads[0]->dtype(), - parallel_desc, *JUST(GetSbpList(ctx->value_sbp)))); - } - (*in_grads)[0] = JUST(functional::LogicalSliceAssign( - JUST(functional::Identity(out_grads[0])), zeros, ctx->start, ctx->stop, ctx->step)); - } - if (ctx->requires_grad_value) { - (*in_grads)[1] = JUST(functional::LogicalSlice(out_grads[0], ctx->start, ctx->stop, ctx->step, - /*enable_view_slice=*/false)); - } - return Maybe::Ok(); - } - - private: - AttrMap base_attrs_; -}; - -REGISTER_OP_EXPR_GRAD_FUNCTION("logical_slice_assign", LogicalSliceAssign); -REGISTER_OP_EXPR_GRAD_FUNCTION("logical_slice", LogicalSlice); - -} // namespace one -} // namespace oneflow diff --git a/oneflow/core/autograd/gradient_funcs/slice.cpp b/oneflow/core/autograd/gradient_funcs/slice.cpp index ef16ac23394..cfa5d6472c8 100644 --- a/oneflow/core/autograd/gradient_funcs/slice.cpp +++ b/oneflow/core/autograd/gradient_funcs/slice.cpp @@ -23,7 +23,6 @@ namespace oneflow { namespace one { struct SliceCaptureState : public AutoGradCaptureState { - bool requires_grad; Shape like_shape; std::vector start; std::vector stop; @@ -34,31 +33,29 @@ class Slice : public OpExprGradFunction { public: Maybe Init(const OpExpr& op) override { const auto* fw_op_expr = dynamic_cast(&op); - CHECK_NOTNULL_OR_RETURN(fw_op_expr); + CHECK_NOTNULL_OR_RETURN(fw_op_expr) << "Slice op_expr is null"; base_attrs_ = MakeAttrMapFromUserOpConf(fw_op_expr->proto()); return Maybe::Ok(); } Maybe Capture(SliceCaptureState* ctx, const TensorTuple& inputs, const TensorTuple& outputs, const AttrMap& attrs) const override { - CHECK_EQ_OR_RETURN(inputs.size(), 1); - CHECK_EQ_OR_RETURN(outputs.size(), 1); - ctx->requires_grad = inputs.at(0)->requires_grad(); - if (!ctx->requires_grad) { return Maybe::Ok(); } + CHECK_EQ_OR_RETURN(inputs.size(), 1) << "Slice input size must be 1"; + CHECK_EQ_OR_RETURN(outputs.size(), 1) << "Slice output size must be 1"; ComposedAttrMap composed_attrs(attrs, base_attrs_); ctx->start = JUST(composed_attrs.GetAttr>("start")); ctx->stop = JUST(composed_attrs.GetAttr>("stop")); ctx->step = JUST(composed_attrs.GetAttr>("step")); - ctx->like_shape = *(inputs.at(0)->shape()); + ctx->like_shape = *(inputs[0]->shape()); return Maybe::Ok(); } Maybe Apply(const SliceCaptureState* ctx, const TensorTuple& out_grads, TensorTuple* in_grads) const override { in_grads->resize(1); - in_grads->at(0) = JUST( - functional::SliceGrad(out_grads.at(0), ctx->like_shape, ctx->start, ctx->stop, ctx->step)); + (*in_grads)[0] = JUST( + functional::SliceGrad(out_grads[0], ctx->like_shape, ctx->start, ctx->stop, ctx->step)); return Maybe::Ok(); } @@ -67,18 +64,20 @@ class Slice : public OpExprGradFunction { }; struct SliceUpdateCaptureState : public AutoGradCaptureState { - bool requires_grad_x; - bool requires_grad_update; + bool requires_grad_ref = false; + bool requires_grad_value = false; std::vector start; std::vector stop; std::vector step; + Shape value_shape; // used to calculate ref gradient + Symbol value_sbp; }; class SliceUpdate : public OpExprGradFunction { public: Maybe Init(const OpExpr& op) override { const auto* fw_op_expr = dynamic_cast(&op); - CHECK_NOTNULL_OR_RETURN(fw_op_expr); + CHECK_NOTNULL_OR_RETURN(fw_op_expr) << "SliceUpdate op_expr is null"; base_attrs_ = MakeAttrMapFromUserOpConf(fw_op_expr->proto()); return Maybe::Ok(); @@ -86,18 +85,21 @@ class SliceUpdate : public OpExprGradFunction { Maybe Capture(SliceUpdateCaptureState* ctx, const TensorTuple& inputs, const TensorTuple& outputs, const AttrMap& attrs) const override { - CHECK_EQ_OR_RETURN(inputs.size(), 2); - CHECK_EQ_OR_RETURN(outputs.size(), 1); - ctx->requires_grad_x = inputs.at(0)->requires_grad(); - ctx->requires_grad_update = inputs.at(1)->requires_grad(); - if (!ctx->requires_grad_x && !ctx->requires_grad_update) { return Maybe::Ok(); } + CHECK_EQ_OR_RETURN(inputs.size(), 2) << "SliceUpdate input size must be 2"; + CHECK_EQ_OR_RETURN(outputs.size(), 1) << "SliceUpdate output size must be 1"; + ctx->requires_grad_ref = inputs[0]->requires_grad(); + ctx->requires_grad_value = inputs[1]->requires_grad(); + if (!ctx->requires_grad_ref && !ctx->requires_grad_value) { return Maybe::Ok(); } ComposedAttrMap composed_attrs(attrs, base_attrs_); ctx->start = JUST(composed_attrs.GetAttr>("start")); ctx->stop = JUST(composed_attrs.GetAttr>("stop")); ctx->step = JUST(composed_attrs.GetAttr>("step")); - if (ctx->requires_grad_x) { ctx->SaveTensorForBackward(inputs.at(1)); } + if (ctx->requires_grad_ref) { + ctx->value_shape = *(inputs[1]->shape()); + if (inputs[1]->is_consistent()) { ctx->value_sbp = JUST(inputs[1]->nd_sbp()); } + } return Maybe::Ok(); } @@ -105,13 +107,21 @@ class SliceUpdate : public OpExprGradFunction { TensorTuple* in_grads) const override { in_grads->resize(2); - if (ctx->requires_grad_x) { - const auto& update = ctx->SavedTensors().at(0); - const auto& temp = JUST(functional::ZerosLike(update)); - (*in_grads)[0] = JUST(functional::SliceUpdate(out_grads[0], temp, ctx->start, ctx->stop, + if (ctx->requires_grad_ref) { + std::shared_ptr zeros; + if (out_grads[0]->is_local()) { + zeros = JUST(functional::Constant(ctx->value_shape, 0, out_grads[0]->dtype(), + JUST(out_grads[0]->device()))); + } else { + const auto& parallel_desc = JUST(out_grads[0]->parallel_desc()); + zeros = + JUST(functional::ConsistentConstant(ctx->value_shape, 0, out_grads[0]->dtype(), + parallel_desc, *JUST(GetSbpList(ctx->value_sbp)))); + } + (*in_grads)[0] = JUST(functional::SliceUpdate(out_grads[0], zeros, ctx->start, ctx->stop, ctx->step, /*inplace=*/false)); } - if (ctx->requires_grad_update) { + if (ctx->requires_grad_value) { (*in_grads)[1] = JUST(functional::Slice(out_grads[0], ctx->start, ctx->stop, ctx->step, /*enable_view_slice=*/false)); } @@ -122,8 +132,8 @@ class SliceUpdate : public OpExprGradFunction { AttrMap base_attrs_; }; -REGISTER_OP_EXPR_GRAD_FUNCTION("slice", Slice); REGISTER_OP_EXPR_GRAD_FUNCTION("slice_update", SliceUpdate); +REGISTER_OP_EXPR_GRAD_FUNCTION("slice", Slice); } // namespace one } // namespace oneflow diff --git a/oneflow/core/boxing/symmetric_b_to_s_boxing.cpp b/oneflow/core/boxing/symmetric_b_to_s_boxing.cpp index ad1b9141e8c..ac477b4b5ab 100644 --- a/oneflow/core/boxing/symmetric_b_to_s_boxing.cpp +++ b/oneflow/core/boxing/symmetric_b_to_s_boxing.cpp @@ -88,8 +88,8 @@ Maybe SymmetricB2S(const std::shared_ptr& tensor, Symb start.emplace_back(range.begin()); stop.emplace_back(range.end()); } - local_tensor = - JUST(one::functional::Slice(local_tensor, start, stop, step, /*enable_view_slice=*/false)); + local_tensor = JUST(one::functional::Slice(local_tensor, start, stop, step, + /*enable_view_slice=*/false)); } return JUST(one::functional::LocalToConsistent(local_tensor, out->placement(), diff --git a/oneflow/core/framework/tensor_methods.cpp b/oneflow/core/framework/tensor_methods.cpp index 69b86a13ab9..6ba21fbb722 100644 --- a/oneflow/core/framework/tensor_methods.cpp +++ b/oneflow/core/framework/tensor_methods.cpp @@ -153,14 +153,14 @@ Maybe Slice(const std::shared_ptr& input, const std::vectorrequires_grad()) { + const Shape in_shape = *input->shape(); auto backward_fn = std::make_shared(); backward_fn->body = [=](const TensorTuple& out_grads, TensorTuple* in_grads, bool create_graph) -> Maybe { autograd::AutoGradMode mode(create_graph); CHECK_EQ_OR_RETURN(out_grads.size(), 1); // NOLINT(maybe-need-error-msg) in_grads->resize(1); - (*in_grads)[0] = JUST(functional::SliceGrad( - JUST(VectorAt(out_grads, 0)), Shape(input->shape()->dim_vec()), starts, ends, steps)); + (*in_grads)[0] = JUST(functional::SliceGrad(out_grads[0], in_shape, starts, ends, steps)); return Maybe::Ok(); }; backward_fn->status = []() { return true; }; diff --git a/oneflow/core/functional/functional_api.yaml b/oneflow/core/functional/functional_api.yaml index aecca3fdf54..e6db3be942c 100755 --- a/oneflow/core/functional/functional_api.yaml +++ b/oneflow/core/functional/functional_api.yaml @@ -1297,14 +1297,6 @@ signature: "Tensor (Tensor x, Int64 start, Int64 end) => SliceView1dContiguous" bind_python: True -- name: "slice" - signature: "Tensor (Tensor x, Int64List start, Int64List stop, Int64List step, Bool enable_view_slice=None) => Slice" - bind_python: True - -- name: "slice_grad" - signature: "Tensor (Tensor dy, Shape like, Int64List start, Int64List stop, Int64List step) => SliceGrad" - bind_python: False - - name: "narrow" signature: "Tensor (Tensor input, Int64 dim, Int64 start, Int64 length) => Narrow" bind_python: True @@ -1313,17 +1305,17 @@ signature: "Tensor (Tensor dy, Tensor like, Int64 dim, Int64 start, Int64 length) => NarrowGrad" bind_python: False -- name: "slice_update" - signature: "Tensor (Tensor x, Tensor update, Int64List start, Int64List stop, Int64List step, *, Bool inplace=False) => SliceUpdate" +- name: "slice" + signature: "Tensor (Tensor x, Int64List start, Int64List stop, Int64List step, Bool enable_view_slice=None) => Slice" bind_python: True -- name: "logical_slice" - signature: "Tensor (Tensor x, Int64List start, Int64List stop, Int64List step, Bool enable_view_slice=None) => LogicalSlice" +- name: "slice_update" + signature: "Tensor (Tensor ref, Tensor value, Int64List start, Int64List stop, Int64List step, Bool inplace=False) => SliceUpdate" bind_python: True -- name: "logical_slice_assign" - signature: "Tensor (Tensor ref, Tensor value, Int64List start, Int64List stop, Int64List step) => LogicalSliceAssign" - bind_python: True +- name: "slice_grad" + signature: "Tensor (Tensor dy, Shape like_shape, Int64List start, Int64List stop, Int64List step) => SliceGrad" + bind_python: False - name: "copy" signature: "Tensor (Tensor x, String device_type, Int64 device_id, Bool pin_memory=False) => Copy" diff --git a/oneflow/core/functional/impl/array_functor.cpp b/oneflow/core/functional/impl/array_functor.cpp index c8f279e45ab..b44a3635207 100644 --- a/oneflow/core/functional/impl/array_functor.cpp +++ b/oneflow/core/functional/impl/array_functor.cpp @@ -1227,59 +1227,6 @@ class InplaceToContiguousFunctor { std::shared_ptr assign_op_; }; -class SliceBaseFunctor { - public: - SliceBaseFunctor() = default; - virtual ~SliceBaseFunctor() = default; - Maybe operator()(const std::shared_ptr& x, const std::vector& start, - const std::vector& stop, const std::vector& step, - const Optional& enable_view_slice) const { - if (view::IsViewApplicable(x) && enable_view_slice.value_or(true)) { - return view::Slice(x, start, stop, step); - } - - MutableAttrMap attrs; - JUST(attrs.SetAttr>("start", start)); - JUST(attrs.SetAttr>("stop", stop)); - JUST(attrs.SetAttr>("step", step)); - return OpInterpUtil::Dispatch(*op_, {x}, attrs); - } - - protected: - std::shared_ptr op_; -}; - -class SliceGradBaseFunctor { - public: - SliceGradBaseFunctor() = default; - virtual ~SliceGradBaseFunctor() = default; - Maybe operator()(const std::shared_ptr& dy, const Shape& like, - const std::vector& start, const std::vector& stop, - const std::vector& step) const { - MutableAttrMap attrs; - JUST(attrs.SetAttr("like_shape", like)); - JUST(attrs.SetAttr>("start", start)); - JUST(attrs.SetAttr>("stop", stop)); - JUST(attrs.SetAttr>("step", step)); - return OpInterpUtil::Dispatch(*op_, {dy}, attrs); - } - - protected: - std::shared_ptr op_; -}; - -class SliceFunctor : public SliceBaseFunctor { - public: - SliceFunctor() { op_ = CHECK_JUST(one::OpBuilder("slice").Input("x").Output("y").Build()); } -}; - -class SliceGradFunctor : public SliceGradBaseFunctor { - public: - SliceGradFunctor() { - op_ = CHECK_JUST(one::OpBuilder("slice_grad").Input("dy").Output("dx").Build()); - } -}; - class NarrowFunctor { public: NarrowFunctor() { op_ = CHECK_JUST(one::OpBuilder("narrow").Input("in").Output("out").Build()); } @@ -1333,45 +1280,35 @@ class NarrowGradFunctor { std::shared_ptr op_; }; -class LogicalSliceFunctor : public SliceBaseFunctor { +class SliceFunctor { public: - LogicalSliceFunctor() { - op_ = CHECK_JUST(one::OpBuilder("logical_slice").Input("x").Output("y").Build()); - } -}; + SliceFunctor() { op_ = CHECK_JUST(one::OpBuilder("slice").Input("x").Output("y").Build()); } + Maybe operator()(const std::shared_ptr& x, const std::vector& start, + const std::vector& stop, const std::vector& step, + const Optional& enable_view_slice) const { + if (view::IsViewApplicable(x) && enable_view_slice.value_or(false)) { + return view::Slice(x, start, stop, step); + } -class LogicalSliceAssignFunctor { - public: - LogicalSliceAssignFunctor() { - op_ = CHECK_JUST( - one::OpBuilder("logical_slice_assign").Input("ref").Input("value").Output("y").Build()); - } - Maybe operator()(const std::shared_ptr& ref, - const std::shared_ptr& value, - const std::vector& start, const std::vector& stop, - const std::vector& step) const { MutableAttrMap attrs; JUST(attrs.SetAttr>("start", start)); JUST(attrs.SetAttr>("stop", stop)); JUST(attrs.SetAttr>("step", step)); - auto outputs = std::make_shared(1); - JUST(CheckInplaceValid(ref)); - JUST(VectorAt(*outputs, 0)) = ref; - JUST(OpInterpUtil::Dispatch(*op_, {ref, value}, outputs.get(), attrs)); - return JUST(VectorAt(*outputs, 0)); + return OpInterpUtil::Dispatch(*op_, {x}, attrs); } - private: + protected: std::shared_ptr op_; }; class SliceUpdateFunctor { public: SliceUpdateFunctor() { - op_ = CHECK_JUST(one::OpBuilder("slice_update").Input("x").Input("update").Output("y").Build()); + op_ = + CHECK_JUST(one::OpBuilder("slice_update").Input("ref").Input("value").Output("y").Build()); } - Maybe operator()(const std::shared_ptr& x, - const std::shared_ptr& update, + Maybe operator()(const std::shared_ptr& ref, + const std::shared_ptr& value, const std::vector& start, const std::vector& stop, const std::vector& step, bool inplace) const { MutableAttrMap attrs; @@ -1380,13 +1317,13 @@ class SliceUpdateFunctor { JUST(attrs.SetAttr>("step", step)); if (inplace) { - JUST(CheckInplaceValid(x)); auto outputs = std::make_shared(1); - (*outputs)[0] = x; - JUST(OpInterpUtil::Dispatch(*op_, {x, update}, outputs.get(), attrs)); - return outputs->at(0); + JUST(CheckInplaceValid(ref)); + JUST(VectorAt(*outputs, 0)) = ref; + JUST(OpInterpUtil::Dispatch(*op_, {ref, value}, outputs.get(), attrs)); + return JUST(VectorAt(*outputs, 0)); } else { - return OpInterpUtil::Dispatch(*op_, {x, update}, attrs); + return OpInterpUtil::Dispatch(*op_, {ref, value}, attrs); } } @@ -1394,6 +1331,26 @@ class SliceUpdateFunctor { std::shared_ptr op_; }; +class SliceGradFunctor { + public: + SliceGradFunctor() { + op_ = CHECK_JUST(one::OpBuilder("slice_grad").Input("dy").Output("dx").Build()); + } + Maybe operator()(const std::shared_ptr& dy, const Shape& like_shape, + const std::vector& start, const std::vector& stop, + const std::vector& step) const { + MutableAttrMap attrs; + JUST(attrs.SetAttr("like_shape", like_shape)); + JUST(attrs.SetAttr>("start", start)); + JUST(attrs.SetAttr>("stop", stop)); + JUST(attrs.SetAttr>("step", step)); + return OpInterpUtil::Dispatch(*op_, {dy}, attrs); + } + + protected: + std::shared_ptr op_; +}; + class UpsampleGradFunctor { public: UpsampleGradFunctor() { @@ -2133,17 +2090,7 @@ class TensorSetItemFunctor { if (slice_shape != *(value_tensor->shape())) { value_tensor = JUST(Reshape(value_tensor, slice_shape)); } - bool requires_grad = - (x->requires_grad() || value_tensor->requires_grad()) && autograd::GradMode::is_enabled(); - if (x->is_local()) { - if (requires_grad) { - JUST(SliceUpdate(x, value_tensor, start, end, step, /*inplace=*/true)); - } else { - JUST(LogicalSliceAssign(x, value_tensor, start, end, step)); - } - } else { - JUST(LogicalSliceAssign(x, value_tensor, start, end, step)); - } + JUST(SliceUpdate(x, value_tensor, start, end, step, /*inplace=*/true)); } return Maybe::Ok(); } @@ -3065,7 +3012,8 @@ class ReshapeLikeFunctor { class PinMemoryFunctor { public: PinMemoryFunctor() { - op_ = CHECK_JUST(one::OpBuilder("slice_update").Input("x").Input("update").Output("y").Build()); + op_ = + CHECK_JUST(one::OpBuilder("slice_update").Input("ref").Input("value").Output("y").Build()); } Maybe operator()(const std::shared_ptr& input) const { // TODO:(zhaoluyang) support consistent tensor.pin_memory() @@ -3150,13 +3098,11 @@ ONEFLOW_FUNCTION_LIBRARY(m) { m.add_functor("View"); m.add_functor("ToContiguous"); m.add_functor("InplaceToContiguous"); - m.add_functor("Slice"); - m.add_functor("SliceGrad"); m.add_functor("Narrow"); m.add_functor("NarrowGrad"); - m.add_functor("LogicalSliceAssign"); - m.add_functor("LogicalSlice"); m.add_functor("SliceUpdate"); + m.add_functor("Slice"); + m.add_functor("SliceGrad"); m.add_functor("SliceView1dContiguous"); m.add_functor("Copy"); m.add_functor("Flip"); diff --git a/oneflow/core/functional/impl/math_functor.cpp b/oneflow/core/functional/impl/math_functor.cpp index 23655f0c00a..71da3290b01 100644 --- a/oneflow/core/functional/impl/math_functor.cpp +++ b/oneflow/core/functional/impl/math_functor.cpp @@ -2137,7 +2137,7 @@ class TensorSplitVecFunctor { output[i] = JUST(Slice(input, start, stop, step, /*enable_view_slice=*/false)); start[pos_dim] = end_idx; } - stop[pos_dim] = input->shape()->At(ndim - 1); + stop[pos_dim] = input->shape()->At(pos_dim); output[num_indices] = JUST(Slice(input, start, stop, step, /*enable_view_slice=*/false)); return output; diff --git a/oneflow/core/functional/tensor_index.cpp b/oneflow/core/functional/tensor_index.cpp index a012231340b..b73564164ab 100644 --- a/oneflow/core/functional/tensor_index.cpp +++ b/oneflow/core/functional/tensor_index.cpp @@ -75,8 +75,8 @@ Maybe ExpandMaskIndex(const std::shared_ptr& index) { JUST(SyncAccessTensorWithTimeOut(size_tensor, callback, "const")); for (int i = 0; i < index->ndim(); ++i) { - auto item = JUST( - functional::Slice((*res)[0], {0, i}, {size, i + 1}, {1, 1}, /*enable_view_slice=*/false)); + auto item = JUST(functional::Slice((*res)[0], {0, i}, {size, i + 1}, {1, 1}, + /*enable_view_slice=*/false)); item = JUST(functional::Reshape(item, {size})); indices->emplace_back(item); } diff --git a/oneflow/ir/include/OneFlow/OneFlowUserOps.td b/oneflow/ir/include/OneFlow/OneFlowUserOps.td index 44a1861912c..1305bfeb6c9 100644 --- a/oneflow/ir/include/OneFlow/OneFlowUserOps.td +++ b/oneflow/ir/include/OneFlow/OneFlowUserOps.td @@ -108,7 +108,7 @@ */ // Group: ASSIGN -// assign, assign_if, assign_if_not, logical_slice_assign +// assign, assign_if, assign_if_not // Total: 4 #ifdef GET_ONEFLOW_ASSIGN_OP_DEFINITIONS @@ -151,25 +151,6 @@ def OneFlow_AssignIfNotOp : OneFlow_BaseOp<"assign_if_not", [NoGrad, DeclareOpIn let has_input_arg_modify_fn = 1; } -def OneFlow_LogicalSliceAssignOp : OneFlow_BaseOp<"logical_slice_assign", [DeclareOpInterfaceMethods]> { - let input = (ins - OneFlow_Tensor:$ref, - OneFlow_Tensor:$value - ); - let output = (outs - OneFlow_Tensor:$y - ); - let attrs = (ins - SI64ArrayAttr:$start, - SI64ArrayAttr:$stop, - SI64ArrayAttr:$step - ); - let has_logical_tensor_desc_infer_fn = 1; - let has_physical_tensor_desc_infer_fn = 1; - let has_get_sbp_fn = 1; - let has_data_type_infer_fn = 1; -} - #endif // GET_ONEFLOW_ASSIGN_OP_DEFINITIONS // Group: BASE @@ -2859,7 +2840,7 @@ def OneFlow_ImageResizeToFixedOp : OneFlow_BaseOp<"image_resize_to_fixed", [NoSi #endif // GET_ONEFLOW_IMAGE_OP_DEFINITIONS // Group: INDICES -// arg_sort, argmax, argwhere, batch_gather, dim_gather, dim_scatter_add, dim_scatter_add_like, dim_scatter_add_scalar, dim_scatter_mul, dim_scatter_mul_scalar, dim_scatter_update, dim_scatter_update_scalar, embedding_renorm, embedding, embedding_grad, gather, gather_nd, generate_random_batch_permutation_indices, image_target_resize, logical_slice, scatter_nd, scatter_nd_like, slice, slice_grad, tensor_scatter_nd_add, tensor_scatter_nd_update, unsorted_batch_segment_sum, unsorted_segment_sum, unsorted_segment_sum_like, where, where_scalar_x, where_scalar_xy, where_scalar_y, median, searchsorted, searchsorted_scalar +// arg_sort, argmax, argwhere, batch_gather, dim_gather, dim_scatter_add, dim_scatter_add_like, dim_scatter_add_scalar, dim_scatter_mul, dim_scatter_mul_scalar, dim_scatter_update, dim_scatter_update_scalar, embedding_renorm, embedding, embedding_grad, gather, gather_nd, generate_random_batch_permutation_indices, image_target_resize, scatter_nd, scatter_nd_like, slice, slice_update, slice_grad, tensor_scatter_nd_add, tensor_scatter_nd_update, unsorted_batch_segment_sum, unsorted_segment_sum, unsorted_segment_sum_like, where, where_scalar_x, where_scalar_xy, where_scalar_y, median, searchsorted, searchsorted_scalar // Total: 36 #ifdef GET_ONEFLOW_INDICES_OP_DEFINITIONS @@ -3203,7 +3184,7 @@ def OneFlow_ImageTargetResizeOp : OneFlow_BaseOp<"image_target_resize", [NoSideE let has_data_type_infer_fn = 1; } -def OneFlow_LogicalSliceOp : OneFlow_BaseOp<"logical_slice", [NoSideEffect, DeclareOpInterfaceMethods]> { +def OneFlow_SliceOp : OneFlow_BaseOp<"slice", [NoSideEffect, DeclareOpInterfaceMethods]> { let input = (ins OneFlow_Tensor:$x ); @@ -3221,75 +3202,76 @@ def OneFlow_LogicalSliceOp : OneFlow_BaseOp<"logical_slice", [NoSideEffect, Decl let has_data_type_infer_fn = 1; } -def OneFlow_ScatterNdOp : OneFlow_BaseOp<"scatter_nd", [NoSideEffect, DeclareOpInterfaceMethods]> { +def OneFlow_SliceUpdateOp : OneFlow_BaseOp<"slice_update", [DeclareOpInterfaceMethods]> { let input = (ins - OneFlow_Tensor:$indices, - OneFlow_Tensor:$updates + OneFlow_Tensor:$ref, + OneFlow_Tensor:$value ); let output = (outs - OneFlow_Tensor:$out + OneFlow_Tensor:$y ); let attrs = (ins - ShapeAttr:$shape + SI64ArrayAttr:$start, + SI64ArrayAttr:$stop, + SI64ArrayAttr:$step ); let has_logical_tensor_desc_infer_fn = 1; let has_physical_tensor_desc_infer_fn = 1; let has_get_sbp_fn = 1; let has_data_type_infer_fn = 1; - let has_input_arg_modify_fn = 1; } -def OneFlow_ScatterNdLikeOp : OneFlow_BaseOp<"scatter_nd_like", [NoSideEffect, DeclareOpInterfaceMethods]> { +def OneFlow_SliceGradOp : OneFlow_BaseOp<"slice_grad", [NoSideEffect, DeclareOpInterfaceMethods]> { let input = (ins - OneFlow_Tensor:$like, - OneFlow_Tensor:$indices, - OneFlow_Tensor:$updates + OneFlow_Tensor:$dy ); let output = (outs - OneFlow_Tensor:$out + OneFlow_Tensor:$dx + ); + let attrs = (ins + ShapeAttr:$like_shape, + SI64ArrayAttr:$start, + SI64ArrayAttr:$stop, + SI64ArrayAttr:$step ); let has_logical_tensor_desc_infer_fn = 1; let has_physical_tensor_desc_infer_fn = 1; let has_get_sbp_fn = 1; let has_data_type_infer_fn = 1; + let has_input_arg_modify_fn = 1; } -def OneFlow_SliceOp : OneFlow_BaseOp<"slice", [NoSideEffect, DeclareOpInterfaceMethods]> { +def OneFlow_ScatterNdOp : OneFlow_BaseOp<"scatter_nd", [NoSideEffect, DeclareOpInterfaceMethods]> { let input = (ins - OneFlow_Tensor:$x + OneFlow_Tensor:$indices, + OneFlow_Tensor:$updates ); let output = (outs - OneFlow_Tensor:$y + OneFlow_Tensor:$out ); let attrs = (ins - SI64ArrayAttr:$start, - SI64ArrayAttr:$stop, - SI64ArrayAttr:$step + ShapeAttr:$shape ); let has_logical_tensor_desc_infer_fn = 1; let has_physical_tensor_desc_infer_fn = 1; let has_get_sbp_fn = 1; let has_data_type_infer_fn = 1; + let has_input_arg_modify_fn = 1; } -def OneFlow_SliceGradOp : OneFlow_BaseOp<"slice_grad", [NoSideEffect, DeclareOpInterfaceMethods]> { +def OneFlow_ScatterNdLikeOp : OneFlow_BaseOp<"scatter_nd_like", [NoSideEffect, DeclareOpInterfaceMethods]> { let input = (ins - OneFlow_Tensor:$dy + OneFlow_Tensor:$like, + OneFlow_Tensor:$indices, + OneFlow_Tensor:$updates ); let output = (outs - OneFlow_Tensor:$dx - ); - let attrs = (ins - ShapeAttr:$like_shape, - SI64ArrayAttr:$start, - SI64ArrayAttr:$stop, - SI64ArrayAttr:$step + OneFlow_Tensor:$out ); let has_logical_tensor_desc_infer_fn = 1; let has_physical_tensor_desc_infer_fn = 1; let has_get_sbp_fn = 1; let has_data_type_infer_fn = 1; - let has_input_arg_modify_fn = 1; } def OneFlow_TensorScatterNdAddOp : OneFlow_BaseOp<"tensor_scatter_nd_add", [NoSideEffect, DeclareOpInterfaceMethods]> { @@ -5743,7 +5725,7 @@ def OneFlow_NormalizationGradOp : OneFlow_BaseOp<"normalization_grad", [NoSideEf #endif // GET_ONEFLOW_NORMALIZATION_OP_DEFINITIONS // Group: OPTIMIZER -// adagrad_update, adam_bias_correction_factor, adam_update, indexed_slices_adam_update, indexed_slices_momentum_update, indexed_slices_sgd_update, lamb_update, lars_update, momentum_update, rmsprop_update, sgd_update, slice_update, ftrl_update +// adagrad_update, adam_bias_correction_factor, adam_update, indexed_slices_adam_update, indexed_slices_momentum_update, indexed_slices_sgd_update, lamb_update, lars_update, momentum_update, rmsprop_update, sgd_update, ftrl_update // Total: 13 #ifdef GET_ONEFLOW_OPTIMIZER_OP_DEFINITIONS @@ -6043,25 +6025,6 @@ def OneFlow_SgdUpdateOp : OneFlow_BaseOp<"sgd_update", [NoGrad, AttrSizedOperand let has_input_arg_modify_fn = 1; } -def OneFlow_SliceUpdateOp : OneFlow_BaseOp<"slice_update", [DeclareOpInterfaceMethods]> { - let input = (ins - OneFlow_Tensor:$x, - OneFlow_Tensor:$update - ); - let output = (outs - OneFlow_Tensor:$y - ); - let attrs = (ins - SI64ArrayAttr:$start, - SI64ArrayAttr:$stop, - SI64ArrayAttr:$step - ); - let has_logical_tensor_desc_infer_fn = 1; - let has_physical_tensor_desc_infer_fn = 1; - let has_get_sbp_fn = 1; - let has_data_type_infer_fn = 1; -} - def OneFlow_FtrlUpdateOp : OneFlow_BaseOp<"ftrl_update", [NoGrad, AttrSizedOperandSegments, DeclareOpInterfaceMethods]> { let input = (ins OneFlow_Tensor:$model, diff --git a/oneflow/user/kernels/slice_kernel.cpp b/oneflow/user/kernels/slice_kernel.cpp index 691ee1b810e..ab1d93c9f7c 100644 --- a/oneflow/user/kernels/slice_kernel.cpp +++ b/oneflow/user/kernels/slice_kernel.cpp @@ -208,43 +208,6 @@ SliceParams ConstructSliceParams(user_op::KernelComputeContext* ctx, const user_ } // namespace -template -class SliceKernel final : public user_op::OpKernel, public user_op::CudaGraphSupport { - public: - SliceKernel() = default; - ~SliceKernel() = default; - - private: - void Compute(user_op::KernelComputeContext* ctx) const override { - const user_op::Tensor* x_tensor = ctx->Tensor4ArgNameAndIndex("x", 0); - user_op::Tensor* y_tensor = ctx->Tensor4ArgNameAndIndex("y", 0); - SliceParams params = ConstructSliceParams(ctx, x_tensor, y_tensor); - SliceKernelUtil::Forward(ctx->stream(), params, x_tensor->dptr(), - y_tensor->mut_dptr()); - } - bool AlwaysComputeWhenAllOutputsEmpty() const override { return false; } -}; - -template -class SliceGradKernel final : public user_op::OpKernel, public user_op::CudaGraphSupport { - public: - SliceGradKernel() = default; - ~SliceGradKernel() = default; - - private: - void Compute(user_op::KernelComputeContext* ctx) const override { - const user_op::Tensor* dy_tensor = ctx->Tensor4ArgNameAndIndex("dy", 0); - user_op::Tensor* dx_tensor = ctx->Tensor4ArgNameAndIndex("dx", 0); - size_t dx_byte_size = dx_tensor->shape().elem_cnt() * sizeof(T); - Memset(ctx->stream(), dx_tensor->mut_dptr(), 0, dx_byte_size); - if (dy_tensor->shape().elem_cnt() == 0) { return; } - SliceParams params = ConstructSliceParams(ctx, dx_tensor, dy_tensor); - SliceKernelUtil::Backward(ctx->stream(), params, dy_tensor->dptr(), - dx_tensor->mut_dptr()); - } - bool AlwaysComputeWhenAllOutputsEmpty() const override { return false; } -}; - template void WriteSlice(user_op::KernelComputeContext* ctx, const user_op::Tensor* src, user_op::Tensor* dst, const SliceContext& slice_ctx, @@ -330,10 +293,10 @@ DEFINE_STATIC_SWITCH_FUNC( #undef MAKE_WRITE_SLICE_SWITCH_ENTRY template -class LogicalSliceKernel final : public user_op::OpKernel { +class SliceKernel final : public user_op::OpKernel { public: - LogicalSliceKernel() = default; - ~LogicalSliceKernel() = default; + SliceKernel() = default; + ~SliceKernel() = default; std::shared_ptr InitOpKernelCache( user_op::KernelCacheContext* ctx) const override { @@ -362,6 +325,7 @@ class LogicalSliceKernel final : public user_op::OpKernel { void Compute(user_op::KernelComputeContext* ctx, user_op::OpKernelState*, const user_op::OpKernelCache* cache) const override { user_op::Tensor* y_tensor = ctx->Tensor4ArgNameAndIndex("y", 0); + if (y_tensor->shape().elem_cnt() == 0) { return; } const user_op::Tensor* x_tensor = ctx->Tensor4ArgNameAndIndex("x", 0); const SliceContext& slice_ctx = dynamic_cast*>(cache)->Get(); @@ -375,10 +339,10 @@ class LogicalSliceKernel final : public user_op::OpKernel { }; template -class LogicalSliceAssignKernel final : public user_op::OpKernel { +class SliceUpdateKernel final : public user_op::OpKernel { public: - LogicalSliceAssignKernel() = default; - ~LogicalSliceAssignKernel() = default; + SliceUpdateKernel() = default; + ~SliceUpdateKernel() = default; std::shared_ptr InitOpKernelCache( user_op::KernelCacheContext* ctx) const override { @@ -423,6 +387,7 @@ class LogicalSliceAssignKernel final : public user_op::OpKernel { const user_op::Tensor* value_tensor = ctx->Tensor4ArgNameAndIndex("value", 0); user_op::Tensor* ref_tensor = ctx->Tensor4ArgNameAndIndex("ref", 0); user_op::Tensor* y_tensor = ctx->Tensor4ArgNameAndIndex("y", 0); + if (y_tensor->shape().elem_cnt() == 0) { return; } // When eager executing, y_tensor shared the same memory with ref_tensor if (ref_tensor->dptr() != y_tensor->dptr()) { // lazy run @@ -438,77 +403,63 @@ class LogicalSliceAssignKernel final : public user_op::OpKernel { bool AlwaysComputeWhenAllOutputsEmpty() const override { return true; } }; +#define REGISTER_SLICE_UPDATE_AND_SLICE_KERNELS(dtype) \ + REGISTER_USER_KERNEL("slice_update") \ + .SetCreateFn>() \ + .SetIsMatchedHob(user_op::HobDataType("ref", 0) == GetDataType::value); \ + REGISTER_USER_KERNEL("slice").SetCreateFn>().SetIsMatchedHob( \ + user_op::HobDataType("x", 0) == GetDataType::value); + +REGISTER_SLICE_UPDATE_AND_SLICE_KERNELS(float) +REGISTER_SLICE_UPDATE_AND_SLICE_KERNELS(double) +REGISTER_SLICE_UPDATE_AND_SLICE_KERNELS(int32_t) +REGISTER_SLICE_UPDATE_AND_SLICE_KERNELS(int64_t) +REGISTER_SLICE_UPDATE_AND_SLICE_KERNELS(int8_t) +REGISTER_SLICE_UPDATE_AND_SLICE_KERNELS(uint8_t) +REGISTER_SLICE_UPDATE_AND_SLICE_KERNELS(bool) +#ifdef WITH_CUDA +REGISTER_SLICE_UPDATE_AND_SLICE_KERNELS(float16) +#endif + template -class SliceUpdateKernel final : public user_op::OpKernel { +class SliceGradKernel final : public user_op::OpKernel, public user_op::CudaGraphSupport { public: - SliceUpdateKernel() = default; - ~SliceUpdateKernel() = default; + SliceGradKernel() = default; + ~SliceGradKernel() = default; private: void Compute(user_op::KernelComputeContext* ctx) const override { - const user_op::Tensor* x_tensor = ctx->Tensor4ArgNameAndIndex("x", 0); - const user_op::Tensor* update_tensor = ctx->Tensor4ArgNameAndIndex("update", 0); - user_op::Tensor* y_tensor = ctx->Tensor4ArgNameAndIndex("y", 0); - Memcpy(ctx->stream(), y_tensor->mut_dptr(), x_tensor->dptr(), - y_tensor->shape().elem_cnt() * sizeof(T)); - SliceParams params = ConstructSliceParams(ctx, y_tensor, update_tensor); - SliceKernelUtil::Backward(ctx->stream(), params, update_tensor->dptr(), - y_tensor->mut_dptr()); + const user_op::Tensor* dy_tensor = ctx->Tensor4ArgNameAndIndex("dy", 0); + user_op::Tensor* dx_tensor = ctx->Tensor4ArgNameAndIndex("dx", 0); + size_t dx_byte_size = dx_tensor->shape().elem_cnt() * sizeof(T); + Memset(ctx->stream(), dx_tensor->mut_dptr(), 0, dx_byte_size); + if (dy_tensor->shape().elem_cnt() == 0) { return; } + SliceParams params = ConstructSliceParams(ctx, dx_tensor, dy_tensor); + SliceKernelUtil::Backward(ctx->stream(), params, dy_tensor->dptr(), + dx_tensor->mut_dptr()); } bool AlwaysComputeWhenAllOutputsEmpty() const override { return false; } }; -#define REGISTER_SLICE_KERNELS(device, dtype) \ - REGISTER_USER_KERNEL("slice").SetCreateFn>().SetIsMatchedHob( \ - (user_op::HobDeviceType() == device) \ - && (user_op::HobDataType("y", 0) == GetDataType::value)); \ - REGISTER_USER_KERNEL("slice_grad") \ - .SetCreateFn>() \ - .SetIsMatchedHob((user_op::HobDeviceType() == device) \ - && (user_op::HobDataType("dx", 0) == GetDataType::value)); \ - REGISTER_USER_KERNEL("slice_update") \ - .SetCreateFn>() \ - .SetIsMatchedHob((user_op::HobDeviceType() == device) \ - && (user_op::HobDataType("x", 0) == GetDataType::value) \ - && (user_op::HobDataType("update", 0) == GetDataType::value)) \ - .SetInplaceProposalFn([](const user_op::InferContext&, \ - user_op::AddInplaceArgPair AddInplaceArgPairFn) -> Maybe { \ - OF_RETURN_IF_ERROR(AddInplaceArgPairFn("y", 0, "x", 0, true)); \ - return Maybe::Ok(); \ - }); - -#define REGISTER_SLICE_KERNELS_WITH_DEVICE(device) \ - REGISTER_SLICE_KERNELS(device, bool) \ - REGISTER_SLICE_KERNELS(device, float) \ - REGISTER_SLICE_KERNELS(device, double) \ - REGISTER_SLICE_KERNELS(device, int32_t) \ - REGISTER_SLICE_KERNELS(device, int64_t) \ - REGISTER_SLICE_KERNELS(device, int8_t) \ - REGISTER_SLICE_KERNELS(device, uint8_t) - -REGISTER_SLICE_KERNELS_WITH_DEVICE(DeviceType::kCPU) -#ifdef WITH_CUDA -REGISTER_SLICE_KERNELS_WITH_DEVICE(DeviceType::kCUDA) -REGISTER_SLICE_KERNELS(DeviceType::kCUDA, float16) -#endif - -#define REGISTER_LOGICAL_SLICE_ASSIGN_AND_LOGICAL_SLICE_KERNELS(dtype) \ - REGISTER_USER_KERNEL("logical_slice_assign") \ - .SetCreateFn>() \ - .SetIsMatchedHob(user_op::HobDataType("ref", 0) == GetDataType::value); \ - REGISTER_USER_KERNEL("logical_slice") \ - .SetCreateFn>() \ - .SetIsMatchedHob(user_op::HobDataType("x", 0) == GetDataType::value); - -REGISTER_LOGICAL_SLICE_ASSIGN_AND_LOGICAL_SLICE_KERNELS(float) -REGISTER_LOGICAL_SLICE_ASSIGN_AND_LOGICAL_SLICE_KERNELS(double) -REGISTER_LOGICAL_SLICE_ASSIGN_AND_LOGICAL_SLICE_KERNELS(int32_t) -REGISTER_LOGICAL_SLICE_ASSIGN_AND_LOGICAL_SLICE_KERNELS(int64_t) -REGISTER_LOGICAL_SLICE_ASSIGN_AND_LOGICAL_SLICE_KERNELS(int8_t) -REGISTER_LOGICAL_SLICE_ASSIGN_AND_LOGICAL_SLICE_KERNELS(uint8_t) -REGISTER_LOGICAL_SLICE_ASSIGN_AND_LOGICAL_SLICE_KERNELS(bool) +#define REGISTER_SLICE_GRAD_KERNEL(device, dtype) \ + REGISTER_USER_KERNEL("slice_grad") \ + .SetCreateFn>() \ + .SetIsMatchedHob((user_op::HobDeviceType() == device) \ + && (user_op::HobDataType("dx", 0) == GetDataType::value)); + +#define REGISTER_SLICE_GRAD_KERNEL_WITH_DEVICE(device) \ + REGISTER_SLICE_GRAD_KERNEL(device, bool) \ + REGISTER_SLICE_GRAD_KERNEL(device, float) \ + REGISTER_SLICE_GRAD_KERNEL(device, double) \ + REGISTER_SLICE_GRAD_KERNEL(device, int32_t) \ + REGISTER_SLICE_GRAD_KERNEL(device, int64_t) \ + REGISTER_SLICE_GRAD_KERNEL(device, int8_t) \ + REGISTER_SLICE_GRAD_KERNEL(device, uint8_t) + +REGISTER_SLICE_GRAD_KERNEL_WITH_DEVICE(DeviceType::kCPU) #ifdef WITH_CUDA -REGISTER_LOGICAL_SLICE_ASSIGN_AND_LOGICAL_SLICE_KERNELS(float16) +REGISTER_SLICE_GRAD_KERNEL_WITH_DEVICE(DeviceType::kCUDA) +REGISTER_SLICE_GRAD_KERNEL(DeviceType::kCUDA, float16) #endif } // namespace oneflow diff --git a/oneflow/user/kernels/slice_util.h b/oneflow/user/kernels/slice_util.h index dd4022ccef7..be76c6289d1 100644 --- a/oneflow/user/kernels/slice_util.h +++ b/oneflow/user/kernels/slice_util.h @@ -16,6 +16,7 @@ limitations under the License. #ifndef ONEFLOW_USER_KERNELS_SLICE_UTIL_H_ #define ONEFLOW_USER_KERNELS_SLICE_UTIL_H_ +#include #include "oneflow/core/common/nd_index_offset_helper.h" #include "oneflow/core/common/util.h" #include "oneflow/core/ep/include/stream.h" @@ -60,6 +61,15 @@ struct SliceParams { if (size[dim] != dims[dim]) { return false; } return true; } + + std::string ToString() { + std::stringstream ss("SliceParams:"); + for (int i = 0; i < ndim; ++i) { + ss << "\n\tdim: " << i << ", start: " << start[i] << ", step: " << step[i] + << ", size: " << size[i]; + } + return ss.str(); + } }; SliceParams FoldContiguousFullSliceDimensions(const SliceParams& params); diff --git a/oneflow/user/ops/slice_op.cpp b/oneflow/user/ops/slice_op.cpp index 10fe52e0699..71e2aa66d92 100644 --- a/oneflow/user/ops/slice_op.cpp +++ b/oneflow/user/ops/slice_op.cpp @@ -29,136 +29,19 @@ bool IsFullSlice(int64_t start, int64_t stop, int64_t step, int64_t size) { } } // namespace -/*static*/ Maybe SliceOp::GetSbp(user_op::SbpContext* ctx) { - const Shape& x_shape = ctx->LogicalTensorDesc4InputArgNameAndIndex("x", 0).shape(); - const int64_t ndim = x_shape.NumAxes(); - const auto& start_vec = ctx->Attr>("start"); - const auto& stop_vec = ctx->Attr>("stop"); - const auto& step_vec = ctx->Attr>("step"); - CHECK_EQ_OR_RETURN(start_vec.size(), ndim); - CHECK_EQ_OR_RETURN(stop_vec.size(), ndim); - CHECK_EQ_OR_RETURN(step_vec.size(), ndim); - - FOR_RANGE(int, i, 0, ndim) { - if (IsFullSlice(start_vec.at(i), stop_vec.at(i), step_vec.at(i), x_shape.At(i))) { - ctx->NewBuilder().Split(ctx->inputs(), i).Split(ctx->outputs(), i).Build(); - } - } - ctx->NewBuilder().PartialSum(ctx->inputs()).PartialSum(ctx->outputs()).Build(); - return Maybe::Ok(); -} -/*static*/ Maybe SliceOp::InferLogicalTensorDesc(user_op::InferContext* ctx) { - const Shape& x_shape = ExpandDimIf0D(ctx->InputShape("x", 0)); - const int64_t ndim = x_shape.NumAxes(); - const auto& start_vec = ctx->Attr>("start"); - const auto& stop_vec = ctx->Attr>("stop"); - const auto& step_vec = ctx->Attr>("step"); - CHECK_EQ_OR_RETURN(start_vec.size(), ndim); - CHECK_EQ_OR_RETURN(stop_vec.size(), ndim); - CHECK_EQ_OR_RETURN(step_vec.size(), ndim); - - DimVector dim_vec(ndim); - FOR_RANGE(size_t, i, 0, dim_vec.size()) { - const int64_t dim_size = x_shape.At(i); - const int64_t step = step_vec.at(i); - int64_t start = start_vec.at(i); - int64_t stop = stop_vec.at(i); - if (dim_size == 0 || start == stop) { - dim_vec[i] = 0; - continue; - } - CHECK_NE_OR_RETURN(step, 0) << "slice step cannot be 0"; - start = RegulateSliceStart(start, dim_size); - stop = RegulateSliceStop(stop, dim_size); - if (step > 0) { - CHECK_LE_OR_RETURN(start, stop) << "slice start must be less than stop when step > 0" - ", otherwise empty result will be outputted."; - } else { - CHECK_GT_OR_RETURN(start, stop) << "slice start must be more than stop when step < 0" - ", otherwise empty result will be outputted."; - } - const int64_t diff = (step > 0) ? (stop - start - 1) : (stop - start + 1); - dim_vec[i] = diff / step + 1; - } - *ctx->OutputShape("y", 0) = Shape(dim_vec); - return Maybe::Ok(); -} -/*static*/ Maybe SliceOp::InferPhysicalTensorDesc(user_op::InferContext* ctx) { - return InferLogicalTensorDesc(ctx); -} -/*static*/ Maybe SliceOp::InferDataType(user_op::InferContext* ctx) { - *ctx->OutputDType("y", 0) = ctx->InputDType("x", 0); - return Maybe::Ok(); -} - -/*static*/ Maybe SliceGradOp::GetSbp(user_op::SbpContext* ctx) { - const Shape& like_shape = ctx->Attr("like_shape"); - const int64_t ndim = like_shape.NumAxes(); - const auto& start_vec = ctx->Attr>("start"); - const auto& stop_vec = ctx->Attr>("stop"); - const auto& step_vec = ctx->Attr>("step"); - CHECK_EQ_OR_RETURN(start_vec.size(), ndim); - CHECK_EQ_OR_RETURN(stop_vec.size(), ndim); - CHECK_EQ_OR_RETURN(step_vec.size(), ndim); - - FOR_RANGE(int, i, 0, ndim) { - if (IsFullSlice(start_vec.at(i), stop_vec.at(i), step_vec.at(i), like_shape.At(i))) { - ctx->NewBuilder().Split(ctx->inputs(), i).Split(ctx->outputs(), i).Build(); - } - } - ctx->NewBuilder().PartialSum(user_op::OpArg("dy", 0)).PartialSum(user_op::OpArg("dx", 0)).Build(); - ctx->NewBuilder().Broadcast(user_op::OpArg("dy", 0)).Broadcast(user_op::OpArg("dx", 0)).Build(); - return Maybe::Ok(); -} -/*static*/ Maybe SliceGradOp::InferLogicalTensorDesc(user_op::InferContext* ctx) { - const Shape& like_shape = ctx->Attr("like_shape"); - const Shape& dy_shape = ctx->InputShape("dy", 0); - const auto& start_vec = ctx->Attr>("start"); - const auto& stop_vec = ctx->Attr>("stop"); - const auto& step_vec = ctx->Attr>("step"); - - const int64_t ndim = dy_shape.NumAxes(); - CHECK_EQ_OR_RETURN(like_shape.NumAxes(), ndim); - CHECK_EQ_OR_RETURN(start_vec.size(), ndim); - CHECK_EQ_OR_RETURN(stop_vec.size(), ndim); - CHECK_EQ_OR_RETURN(step_vec.size(), ndim); - *ctx->OutputShape("dx", 0) = like_shape; - return Maybe::Ok(); -} -/*static*/ Maybe SliceGradOp::InferPhysicalTensorDesc(user_op::InferContext* ctx) { - Shape logical_shape = ctx->Attr("like_shape"); - const user_op::TensorDesc& dy_desc = ctx->InputTensorDesc("dy", 0); - user_op::TensorDesc* dx_desc = ctx->OutputTensorDesc("dx", 0); - *dx_desc->mut_is_dynamic() = dy_desc.is_dynamic(); - - const auto& nd_sbp = ctx->NdSbp4ArgNameAndIndex("dx", 0); - *(dx_desc->mut_shape()) = - *JUST(GetPhysicalShape(logical_shape, nd_sbp, ctx->parallel_desc(), ctx->parallel_ctx())); - int dx_ndim = dx_desc->shape().NumAxes(); - int dy_ndim = dy_desc.shape().NumAxes(); - CHECK_EQ_OR_RETURN(dx_ndim, dy_ndim) - << "Output dimension (" << dx_ndim << ") should equal to the input dimension (" << dy_ndim - << ") for slice backward."; - return Maybe::Ok(); -} -/*static*/ Maybe SliceGradOp::InferDataType(user_op::InferContext* ctx) { - *ctx->OutputDType("dx", 0) = ctx->InputDType("dy", 0); - return Maybe::Ok(); -} -/*static*/ Maybe SliceGradOp::ModifyInputArg(const GetInputArgModifier& GetInputArgModifierFn, - const user_op::UserOpConfWrapper&) { - user_op::InputArgModifier* dy_modifier = GetInputArgModifierFn("dy", 0); - CHECK_NOTNULL_OR_RETURN(dy_modifier); - dy_modifier->set_requires_grad(false); - return Maybe::Ok(); -} - -/*static*/ Maybe LogicalSliceAssignOp::GetSbp(user_op::SbpContext* ctx) { +/*static*/ Maybe SliceUpdateOp::GetSbp(user_op::SbpContext* ctx) { const Shape& x_shape = ctx->LogicalTensorDesc4InputArgNameAndIndex("ref", 0).shape(); const int64_t ndim = x_shape.NumAxes(); const auto& start_vec = ctx->Attr>("start"); const auto& stop_vec = ctx->Attr>("stop"); const auto& step_vec = ctx->Attr>("step"); + CHECK_EQ_OR_RETURN(start_vec.size(), ndim) + << "start_vec's dim not equal to ref shape's dim: " << start_vec.size() << " vs " << ndim; + CHECK_EQ_OR_RETURN(stop_vec.size(), ndim) + << "stop_vec's dim not equal to ref shape's dim: " << start_vec.size() << " vs " << ndim; + CHECK_EQ_OR_RETURN(step_vec.size(), ndim) + << "step_vec's dim not equal to ref shape's dim: " << start_vec.size() << " vs " << ndim; + FOR_RANGE(int64_t, axis, 0, ndim) { ctx->NewBuilder() .Split(user_op::OpArg("ref", 0), axis) @@ -177,8 +60,9 @@ bool IsFullSlice(int64_t start, int64_t stop, int64_t step, int64_t size) { .Build(); return Maybe::Ok(); } -/*static*/ Maybe LogicalSliceAssignOp::InferLogicalTensorDesc(user_op::InferContext* ctx) { +/*static*/ Maybe SliceUpdateOp::InferLogicalTensorDesc(user_op::InferContext* ctx) { const user_op::TensorDesc& ref_desc = ctx->InputTensorDesc("ref", 0); + const Shape& value_shape = ctx->InputTensorDesc("value", 0).shape(); const auto& start_vec = ctx->Attr>("start"); const auto& stop_vec = ctx->Attr>("stop"); const auto& step_vec = ctx->Attr>("step"); @@ -187,20 +71,24 @@ bool IsFullSlice(int64_t start, int64_t stop, int64_t step, int64_t size) { const int64_t step = step_vec.at(i); const int64_t start = start_vec.at(i); const int64_t stop = stop_vec.at(i); - CHECK_GT_OR_RETURN(step, 0) << "logical_slice_assign step must be greater than 0"; - CHECK_GE_OR_RETURN(start, 0) << "logical_slice_assign start must be greater or equal to 0"; - CHECK_GT_OR_RETURN(stop, 0) << "logical_slice_assign stop must be greater than 0"; - CHECK_LT_OR_RETURN(start, stop) << "logical_slice_assign start must be less than stop"; + CHECK_GT_OR_RETURN(step, 0) << "slice_update step must be greater than 0"; + CHECK_GE_OR_RETURN(start, 0) << "slice_update start must be greater or equal to 0"; + CHECK_GE_OR_RETURN(stop, 0) << "slice_update stop must be greater or equal than 0"; + CHECK_LE_OR_RETURN(start, stop) << "slice_update start must be less or equal than stop"; + CHECK_EQ_OR_RETURN((stop - start + step - 1) / step, value_shape.At(i)) + << "slice_update slice tuple size must equal to value tensor shape, but got " << start + << ":" << stop << ":" << step << " vs " << value_shape.At(i) << " at dim " + << "i"; } auto* y_desc = ctx->OutputTensorDesc("y", 0); *y_desc->mut_shape() = ref_desc.shape(); *y_desc->mut_is_dynamic() = ref_desc.is_dynamic(); return Maybe::Ok(); } -/*static*/ Maybe LogicalSliceAssignOp::InferPhysicalTensorDesc(user_op::InferContext* ctx) { +/*static*/ Maybe SliceUpdateOp::InferPhysicalTensorDesc(user_op::InferContext* ctx) { return InferLogicalTensorDesc(ctx); } -/*static*/ Maybe LogicalSliceAssignOp::InferDataType(user_op::InferContext* ctx) { +/*static*/ Maybe SliceUpdateOp::InferDataType(user_op::InferContext* ctx) { const user_op::TensorDesc& ref_desc = ctx->InputTensorDesc("ref", 0); const user_op::TensorDesc& value_desc = ctx->InputTensorDesc("value", 0); CHECK_OR_RETURN(ref_desc.data_type() == value_desc.data_type()); @@ -209,7 +97,7 @@ bool IsFullSlice(int64_t start, int64_t stop, int64_t step, int64_t size) { return Maybe::Ok(); } -/*static*/ Maybe LogicalSliceOp::GetSbp(user_op::SbpContext* ctx) { +/*static*/ Maybe SliceOp::GetSbp(user_op::SbpContext* ctx) { const user_op::TensorDesc& input_desc = ctx->LogicalTensorDesc4InputArgNameAndIndex("x", 0); FOR_RANGE(int64_t, axis, 0, input_desc.shape().NumAxes()) { ctx->NewBuilder() @@ -221,7 +109,7 @@ bool IsFullSlice(int64_t start, int64_t stop, int64_t step, int64_t size) { ctx->NewBuilder().PartialSum(user_op::OpArg("x", 0)).PartialSum(user_op::OpArg("y", 0)).Build(); return Maybe::Ok(); } -/*static*/ Maybe LogicalSliceOp::InferLogicalTensorDesc(user_op::InferContext* ctx) { +/*static*/ Maybe SliceOp::InferLogicalTensorDesc(user_op::InferContext* ctx) { const Shape& x_shape = ctx->InputShape("x", 0); const int64_t ndim = x_shape.NumAxes(); const auto& start_vec = ctx->Attr>("start"); @@ -232,154 +120,97 @@ bool IsFullSlice(int64_t start, int64_t stop, int64_t step, int64_t size) { const int64_t step = step_vec.at(i); const int64_t start = start_vec.at(i); const int64_t stop = stop_vec.at(i); - CHECK_GT_OR_RETURN(step, 0) << "LogicalSlice step must be greater than 0"; - CHECK_GE_OR_RETURN(start, 0) << "LogicalSlice start must be greater or equal to 0"; - CHECK_GT_OR_RETURN(stop, 0) << "LogicalSlice stop must be greater than 0"; - CHECK_LT_OR_RETURN(start, stop) << "LogicalSlice start must be less than stop"; + CHECK_GT_OR_RETURN(step, 0) << "Slice step must be greater than 0"; + CHECK_GE_OR_RETURN(start, 0) << "Slice start must be greater or equal to 0"; + CHECK_GE_OR_RETURN(stop, 0) << "Slice stop must be greater or equal to 0"; + CHECK_LE_OR_RETURN(start, stop) << "Slice start must be less or equal to stop"; const int64_t diff = stop - start - 1; dim_vec[i] = diff / step + 1; } *ctx->OutputShape("y", 0) = Shape(dim_vec); return Maybe::Ok(); } -/*static*/ Maybe LogicalSliceOp::InferPhysicalTensorDesc(user_op::InferContext* ctx) { +/*static*/ Maybe SliceOp::InferPhysicalTensorDesc(user_op::InferContext* ctx) { return InferLogicalTensorDesc(ctx); } -/*static*/ Maybe LogicalSliceOp::InferDataType(user_op::InferContext* ctx) { +/*static*/ Maybe SliceOp::InferDataType(user_op::InferContext* ctx) { *ctx->OutputDType("y", 0) = ctx->InputDType("x", 0); return Maybe::Ok(); } -/*static*/ Maybe SliceUpdateOp::GetSbp(user_op::SbpContext* ctx) { - const Shape& x_shape = ctx->LogicalTensorDesc4InputArgNameAndIndex("x", 0).shape(); - const int64_t ndim = x_shape.NumAxes(); +/*static*/ Maybe SliceGradOp::GetSbp(user_op::SbpContext* ctx) { + const Shape& like_shape = ctx->Attr("like_shape"); + const int64_t ndim = like_shape.NumAxes(); const auto& start_vec = ctx->Attr>("start"); const auto& stop_vec = ctx->Attr>("stop"); const auto& step_vec = ctx->Attr>("step"); - CHECK_EQ_OR_RETURN(start_vec.size(), ndim); - CHECK_EQ_OR_RETURN(stop_vec.size(), ndim); - CHECK_EQ_OR_RETURN(step_vec.size(), ndim); + CHECK_EQ_OR_RETURN(start_vec.size(), ndim) + << "start_vec's dim not equal to ref shape's dim: " << start_vec.size() << " vs " << ndim; + CHECK_EQ_OR_RETURN(stop_vec.size(), ndim) + << "stop_vec's dim not equal to ref shape's dim: " << start_vec.size() << " vs " << ndim; + CHECK_EQ_OR_RETURN(step_vec.size(), ndim) + << "step_vec's dim not equal to ref shape's dim: " << start_vec.size() << " vs " << ndim; FOR_RANGE(int, i, 0, ndim) { - if (IsFullSlice(start_vec.at(i), stop_vec.at(i), step_vec.at(i), x_shape.At(i))) { + if (IsFullSlice(start_vec[i], stop_vec[i], step_vec[i], like_shape.At(i))) { ctx->NewBuilder().Split(ctx->inputs(), i).Split(ctx->outputs(), i).Build(); } } - ctx->NewBuilder().PartialSum(ctx->inputs()).PartialSum(ctx->outputs()).Build(); + ctx->NewBuilder().PartialSum(user_op::OpArg("dy", 0)).PartialSum(user_op::OpArg("dx", 0)).Build(); + ctx->NewBuilder().Broadcast(user_op::OpArg("dy", 0)).Broadcast(user_op::OpArg("dx", 0)).Build(); return Maybe::Ok(); } - -/*static*/ Maybe SliceUpdateOp::InferLogicalTensorDesc(user_op::InferContext* ctx) { - const auto& x_desc = ctx->InputTensorDesc("x", 0); - const int64_t ndim = x_desc.shape().NumAxes(); - const auto& update_desc = ctx->InputTensorDesc("update", 0); - CHECK_EQ_OR_RETURN(update_desc.shape().NumAxes(), ndim); +/*static*/ Maybe SliceGradOp::InferLogicalTensorDesc(user_op::InferContext* ctx) { + const Shape& like_shape = ctx->Attr("like_shape"); + const Shape& dy_shape = ctx->InputShape("dy", 0); const auto& start_vec = ctx->Attr>("start"); const auto& stop_vec = ctx->Attr>("stop"); const auto& step_vec = ctx->Attr>("step"); - CHECK_EQ_OR_RETURN(start_vec.size(), ndim); - CHECK_EQ_OR_RETURN(stop_vec.size(), ndim); - CHECK_EQ_OR_RETURN(step_vec.size(), ndim); - // validate update shape and start, stop, step attributes - FOR_RANGE(int, i, 0, ndim) { - const int64_t dim_size = x_desc.shape().At(i); - const int64_t step = step_vec.at(i); - CHECK_NE_OR_RETURN(step, 0) << "slice step cannot be 0"; - int64_t start = RegulateSliceStart(start_vec.at(i), dim_size); - int64_t stop = RegulateSliceStop(stop_vec.at(i), dim_size); - if (step > 0) { - CHECK_LT_OR_RETURN(start, stop) << "slice start must be less than stop when step > 0" - ", otherwise empty result will be outputted."; - } else { - CHECK_GT_OR_RETURN(start, stop) << "slice start must be more than stop when step < 0" - ", otherwise empty result will be outputted."; - } - const int64_t diff = (step > 0) ? (stop - start - 1) : (stop - start + 1); - const int64_t sliced_dim_size = diff / step + 1; - CHECK_EQ_OR_RETURN(sliced_dim_size, update_desc.shape().At(i)) - << "sliced dim size " << sliced_dim_size << " at axis " << i - << " not equal to the update shape " << update_desc.shape().ToString(); - } - auto* y_desc = ctx->OutputTensorDesc("y", 0); - *y_desc->mut_shape() = x_desc.shape(); - *y_desc->mut_is_dynamic() = x_desc.is_dynamic(); + + const int64_t ndim = dy_shape.NumAxes(); + CHECK_EQ_OR_RETURN(start_vec.size(), ndim) + << "start_vec's dim not equal to ref shape's dim: " << start_vec.size() << " vs " << ndim; + CHECK_EQ_OR_RETURN(stop_vec.size(), ndim) + << "stop_vec's dim not equal to ref shape's dim: " << start_vec.size() << " vs " << ndim; + CHECK_EQ_OR_RETURN(step_vec.size(), ndim) + << "step_vec's dim not equal to ref shape's dim: " << start_vec.size() << " vs " << ndim; + *ctx->OutputShape("dx", 0) = like_shape; return Maybe::Ok(); } -/*static*/ Maybe SliceUpdateOp::InferPhysicalTensorDesc(user_op::InferContext* ctx) { - return InferLogicalTensorDesc(ctx); -} -/*static*/ Maybe SliceUpdateOp::InferDataType(user_op::InferContext* ctx) { - const auto& x_desc = ctx->InputTensorDesc("x", 0); - const auto& update_desc = ctx->InputTensorDesc("update", 0); - CHECK_EQ_OR_RETURN(update_desc.data_type(), x_desc.data_type()); - auto* y_desc = ctx->OutputTensorDesc("y", 0); - *y_desc->mut_data_type() = x_desc.data_type(); +/*static*/ Maybe SliceGradOp::InferPhysicalTensorDesc(user_op::InferContext* ctx) { + Shape logical_shape = ctx->Attr("like_shape"); + const user_op::TensorDesc& dy_desc = ctx->InputTensorDesc("dy", 0); + user_op::TensorDesc* dx_desc = ctx->OutputTensorDesc("dx", 0); + *dx_desc->mut_is_dynamic() = dy_desc.is_dynamic(); + + const auto& nd_sbp = ctx->NdSbp4ArgNameAndIndex("dx", 0); + *(dx_desc->mut_shape()) = + *JUST(GetPhysicalShape(logical_shape, nd_sbp, ctx->parallel_desc(), ctx->parallel_ctx())); + int dx_ndim = dx_desc->shape().NumAxes(); + int dy_ndim = dy_desc.shape().NumAxes(); + CHECK_EQ_OR_RETURN(dx_ndim, dy_ndim) + << "Output dimension (" << dx_ndim << ") should equal to the input dimension (" << dy_ndim + << ") for slice backward."; return Maybe::Ok(); } - -namespace { - -Maybe GenSliceGradOp(const user_op::UserOpWrapper& op, user_op::AddOpFn AddOp) { - if (op.NeedGenGradTensor4OpInput("x", 0)) { - const auto& x_desc = op.TensorDesc4ArgNameAndIndex("x", 0); - user_op::UserOpConfWrapperBuilder builder(op.op_name() + "_grad"); - user_op::UserOpConfWrapper grad_op = builder.Op("slice_grad") - .Input("dy", op.GetGradTensorWithOpOutput("y", 0)) - .Attr("like_shape", x_desc.shape()) - .Attr("start", op.attr>("start")) - .Attr("stop", op.attr>("stop")) - .Attr("step", op.attr>("step")) - .Output("dx") - .Build(); - op.BindGradTensorWithOpInput(grad_op.output("dx", 0), "x", 0); - AddOp(grad_op); - } +/*static*/ Maybe SliceGradOp::InferDataType(user_op::InferContext* ctx) { + *ctx->OutputDType("dx", 0) = ctx->InputDType("dy", 0); return Maybe::Ok(); } - -Maybe GenSliceUpdateGradOp(user_op::BackwardOpConfContext* ctx) { - const std::string update_grad_op_name = ctx->FwOp().op_name() + "_update_grad"; - ctx->DefineOp(update_grad_op_name, [&](user_op::BackwardOpBuilder& builder) { - return builder.OpTypeName("slice") - .InputBind("x", ctx->FwOp().output_grad("y", 0)) - .Attr("start", ctx->FwOp().attr>("start")) - .Attr("stop", ctx->FwOp().attr>("stop")) - .Attr("step", ctx->FwOp().attr>("step")) - .Output("y") - .Build(); - }); - ctx->FwOp().InputGradBind(user_op::OpArg("update", 0), [&]() -> const std::string& { - return ctx->GetOp(update_grad_op_name).output("y", 0); - }); - - const std::string zero_grad_op_name = ctx->FwOp().op_name() + "_zero_grad"; - ctx->DefineOp(zero_grad_op_name, [&](user_op::BackwardOpBuilder& builder) { - return builder.OpTypeName("zero_like") - .InputBind("like", ctx->FwOp().input("update", 0)) - .Output("out") - .Build(); - }); - const std::string x_grad_op_name = ctx->FwOp().op_name() + "_x_grad"; - ctx->DefineOp(x_grad_op_name, [&](user_op::BackwardOpBuilder& builder) { - return builder.OpTypeName("slice_update") - .InputBind("x", ctx->FwOp().output_grad("y", 0)) - .InputBind("update", ctx->GetOp(zero_grad_op_name).output("out", 0)) - .Attr("start", ctx->FwOp().attr>("start")) - .Attr("stop", ctx->FwOp().attr>("stop")) - .Attr("step", ctx->FwOp().attr>("step")) - .Output("y") - .Build(); - }); - ctx->FwOp().InputGradBind(user_op::OpArg("x", 0), [&]() -> const std::string& { - return ctx->GetOp(x_grad_op_name).output("y", 0); - }); +/*static*/ Maybe SliceGradOp::ModifyInputArg(const GetInputArgModifier& GetInputArgModifierFn, + const user_op::UserOpConfWrapper&) { + user_op::InputArgModifier* dy_modifier = GetInputArgModifierFn("dy", 0); + dy_modifier->set_requires_grad(false); return Maybe::Ok(); } -Maybe GenLogicalSliceAssignGradOp(user_op::BackwardOpConfContext* ctx) { +namespace { + +Maybe GenSliceUpdateGradOp(user_op::BackwardOpConfContext* ctx) { + // value grad const std::string update_grad_op_name = ctx->FwOp().op_name() + "_value_grad"; ctx->DefineOp(update_grad_op_name, [&](user_op::BackwardOpBuilder& builder) { - return builder.OpTypeName("logical_slice") + return builder.OpTypeName("slice") .InputBind("x", ctx->FwOp().output_grad("y", 0)) .Attr("start", ctx->FwOp().attr>("start")) .Attr("stop", ctx->FwOp().attr>("stop")) @@ -391,6 +222,7 @@ Maybe GenLogicalSliceAssignGradOp(user_op::BackwardOpConfContext* ctx) { return ctx->GetOp(update_grad_op_name).output("y", 0); }); + // ref grad const std::string zero_grad_op_name = ctx->FwOp().op_name() + "_zero_grad"; ctx->DefineOp(zero_grad_op_name, [&](user_op::BackwardOpBuilder& builder) { return builder.OpTypeName("zero_like") @@ -400,7 +232,7 @@ Maybe GenLogicalSliceAssignGradOp(user_op::BackwardOpConfContext* ctx) { }); const std::string x_grad_op_name = ctx->FwOp().op_name() + "_x_grad"; ctx->DefineOp(x_grad_op_name, [&](user_op::BackwardOpBuilder& builder) { - return builder.OpTypeName("logical_slice_assign") + return builder.OpTypeName("slice_update") .InputBind("ref", ctx->FwOp().output_grad("y", 0)) .InputBind("value", ctx->GetOp(zero_grad_op_name).output("out", 0)) .Attr("start", ctx->FwOp().attr>("start")) @@ -415,37 +247,27 @@ Maybe GenLogicalSliceAssignGradOp(user_op::BackwardOpConfContext* ctx) { return Maybe::Ok(); } -Maybe GenLogicalSliceGradOp(user_op::BackwardOpConfContext* ctx) { - const std::string zero_grad_op_name = ctx->FwOp().op_name() + "_zero_grad"; - ctx->DefineOp(zero_grad_op_name, [&](user_op::BackwardOpBuilder& builder) { - return builder.OpTypeName("zero_like") - .InputBind("like", ctx->FwOp().input("x", 0)) - .Output("out") - .Build(); - }); - const std::string x_grad_op_name = ctx->FwOp().op_name() + "_x_grad"; - ctx->DefineOp(x_grad_op_name, [&](user_op::BackwardOpBuilder& builder) { - return builder.OpTypeName("logical_slice_assign") - .InputBind("ref", ctx->GetOp(zero_grad_op_name).output("out", 0)) - .InputBind("value", ctx->FwOp().output_grad("y", 0)) +Maybe GenSliceGradOp(user_op::BackwardOpConfContext* ctx) { + const std::string ref_grad_op_name = ctx->FwOp().op_name() + "_x_grad"; + ctx->DefineOp(ref_grad_op_name, [&](user_op::BackwardOpBuilder& builder) { + return builder.OpTypeName("slice_grad") + .InputBind("dy", ctx->FwOp().output_grad("y", 0)) + .Attr("like_shape", ctx->FwOp().arg_tensor_desc("x", 0).shape()) .Attr("start", ctx->FwOp().attr>("start")) .Attr("stop", ctx->FwOp().attr>("stop")) .Attr("step", ctx->FwOp().attr>("step")) - .Output("y") + .Output("dx") .Build(); }); ctx->FwOp().InputGradBind(user_op::OpArg("x", 0), [&]() -> const std::string& { - return ctx->GetOp(x_grad_op_name).output("y", 0); + return ctx->GetOp(ref_grad_op_name).output("dx", 0); }); - return Maybe::Ok(); } } // namespace -REGISTER_USER_OP_GRAD("slice").SetGenBackwardOpConfFn(GenSliceGradOp); REGISTER_USER_OP_GRAD("slice_update").SetBackwardOpConfGenFn(GenSliceUpdateGradOp); -REGISTER_USER_OP_GRAD("logical_slice_assign").SetBackwardOpConfGenFn(GenLogicalSliceAssignGradOp); -REGISTER_USER_OP_GRAD("logical_slice").SetBackwardOpConfGenFn(GenLogicalSliceGradOp); +REGISTER_USER_OP_GRAD("slice").SetBackwardOpConfGenFn(GenSliceGradOp); } // namespace oneflow diff --git a/python/oneflow/__init__.py b/python/oneflow/__init__.py index 949d7b01d45..2dcd99309fb 100755 --- a/python/oneflow/__init__.py +++ b/python/oneflow/__init__.py @@ -358,8 +358,7 @@ def atexit_hook(hook): from oneflow.nn.modules.reshape import reshape_op as reshape from oneflow.nn.modules.reshape import view_op as view from oneflow.nn.modules.slice import slice_op as slice -from oneflow.nn.modules.slice import logical_slice_assign_op as logical_slice_assign -from oneflow.nn.modules.slice import logical_slice_op as logical_slice +from oneflow.nn.modules.slice import slice_update_op as slice_update from oneflow.nn.modules.sort import sort_op as sort from oneflow.nn.modules.tensor_buffer import gen_tensor_buffer from oneflow.nn.modules.tensor_buffer import ( diff --git a/python/oneflow/framework/docstr/math_ops.py b/python/oneflow/framework/docstr/math_ops.py index 97b7281a45e..60545405b41 100644 --- a/python/oneflow/framework/docstr/math_ops.py +++ b/python/oneflow/framework/docstr/math_ops.py @@ -1675,8 +1675,8 @@ >>> import oneflow as flow - >>> input = flow.rand(3,4,5,6) - >>> output = flow.vsplit(input,(1,3)) + >>> input = flow.rand(4, 4, 5, 6) + >>> output = flow.vsplit(input, (1, 3)) >>> output[0].size() oneflow.Size([1, 4, 5, 6]) >>> output[1].size() diff --git a/python/oneflow/framework/tensor_str_util.py b/python/oneflow/framework/tensor_str_util.py index afbd436167f..742990a9e39 100644 --- a/python/oneflow/framework/tensor_str_util.py +++ b/python/oneflow/framework/tensor_str_util.py @@ -22,15 +22,12 @@ def slice_wrapper(tensor, slice_tuple: Tuple[int, int, int]): with flow.no_grad(): ndim = tensor.ndim slice_tuple_list = [slice_tuple] + [[None, None, None]] * (ndim - 1) - # TODO(): a kind 'slice op' supports both local and global tensor - if tensor.is_global: - # input is s0, output is p - # input is b, output is b - # input is p, output is p - # so 'to b' is not needed here - tensor = flow.logical_slice(tensor, slice_tuple_list) - else: - tensor = flow.slice(tensor, slice_tuple_list) + # If tensor is global_tensor + # input is s0, output is p + # input is b, output is b + # input is p, output is p + # so 'to b' is not needed here + tensor = flow.slice(tensor, slice_tuple_list) # TODO(): flow.sequeeze will fail in some global tensor case if tensor.shape[0] == 1 and ndim > 1: tensor = tensor.reshape(list(tensor.shape[1:])) diff --git a/python/oneflow/nn/modules/slice.py b/python/oneflow/nn/modules/slice.py index c17068247f6..c0c36d2cff5 100644 --- a/python/oneflow/nn/modules/slice.py +++ b/python/oneflow/nn/modules/slice.py @@ -44,10 +44,8 @@ def slice_op(input, slice_tup_list: Sequence[Tuple[int, int, int]]): return flow._C.slice(input, start, stop, step) -def logical_slice_assign_op( - input, update, slice_tup_list: Sequence[Tuple[int, int, int]] -): - """Update a slice of tensor `x`(in-place). Like `x[start:stop:step] = update`. +def slice_update_op(input, update, slice_tup_list: Sequence[Tuple[int, int, int]]): + """Update a slice of tensor `x`. Like `x[start:stop:step] = update`. Args: x: A `Tensor`, whose slice will be updated. @@ -63,8 +61,7 @@ def logical_slice_assign_op( >>> input = flow.Tensor(np.array([1, 1, 1, 1, 1]).astype(np.float32)) >>> update = flow.Tensor(np.array([2, 3, 4]).astype(np.float32)) - >>> y = flow.logical_slice_assign(input, update, slice_tup_list=[[1, 4, 1]]) - >>> input + >>> flow.slice_update(input, update, slice_tup_list=[[1, 4, 1]]) tensor([1., 2., 3., 4., 1.], dtype=oneflow.float32) """ @@ -72,34 +69,7 @@ def logical_slice_assign_op( (start, stop, step) = parse_slice_tuple_list(slice_tup_list, input.shape) if update.dtype != input.dtype: update = update.to(dtype=input.dtype) - return flow._C.logical_slice_assign(input, update, start, stop, step) - - -def logical_slice_op(input, slice_tup_list: Sequence[Tuple[int, int, int]]): - """Extracts a slice from a global tensor. - The `slice_tup_list` assigns the slice indices in each dimension, the format is (start, stop, step). - The operator will slice the tensor according to the `slice_tup_list`. - - Args: - input: A `Tensor`. - slice_tup_list: A list of slice tuple, indicate each dimension slice (start, stop, step). - - For example: - - .. code-block:: python - - >>> import oneflow as flow - - >>> placement = flow.placement("cpu", ranks=[0]) - >>> x = flow.Tensor([[1, 2], [3, 4]], placement=placement, sbp=flow.sbp.broadcast) - >>> y = flow.logical_slice(x, slice_tup_list=[[0, 1, 1]]) - >>> y.numpy() - array([[1., 2.]], dtype=float32) - - """ - - (start, stop, step) = parse_slice_tuple_list(slice_tup_list, input.shape) - return flow._C.logical_slice(input, start, stop, step) + return flow._C.slice_update(input, update, start, stop, step, inplace=True) if __name__ == "__main__": diff --git a/python/oneflow/test/README.md b/python/oneflow/test/README.md index 1bb55344fd4..7ada2be57d5 100644 --- a/python/oneflow/test/README.md +++ b/python/oneflow/test/README.md @@ -3,7 +3,7 @@ |op name | Doc Test | Compatiable/Completeness Test | Exception | | ------------------------- | ------------- | ----------------------------- | --------- | -| oneflow.Tensor | [oneflow.tensor](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L20) | [tensor_scatter_nd_update](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_tensor_scatter_nd_update.py#L91) | | +| oneflow.Tensor | [oneflow.tensor](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L20) | [tensor_init](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_generator.py#L161) | [tensordot_neg_dims_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_tensordot.py#L25) | | oneflow.BoolTensor | | | | | oneflow.ByteTensor | | | | | oneflow.CharTensor | | | | @@ -12,107 +12,107 @@ | oneflow.HalfTensor | | | | | oneflow.IntTensor | | | | | oneflow.LongTensor | | | | -| oneflow.Size | [oneflow.Tensor.size](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1127) | | | -| oneflow.abs | [oneflow.Tensor.abs](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L471) | [abs_with_ndim_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_abs.py#L34) | | -| oneflow.acos | [oneflow.Tensor.acos](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L478) | [acos_flow_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_math_ops.py#L348) | | -| oneflow.acosh | [oneflow.Tensor.acosh](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L492) | [acosh_flow_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_math_ops.py#L368) | | +| oneflow.Size | [oneflow.Tensor.size](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1319) | | [splitwithsize_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_array_functor.py#L239) | +| oneflow.abs | [oneflow.Tensor.abs](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L628) | [abs_with_0_size_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_abs.py#L27) | | +| oneflow.acos | [oneflow.Tensor.acos](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L635) | [acos_flow_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_math_ops.py#L348) | | +| oneflow.acosh | [oneflow.Tensor.acosh](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L649) | [acosh_flow_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_math_ops.py#L368) | | | oneflow.adaptive_avg_pool1d | | | | | oneflow.adaptive_avg_pool2d | | | | | oneflow.adaptive_avg_pool3d | | | | -| oneflow.add | [oneflow.Tensor.add](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L985) | [add_with_alpha](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_add.py#L198) | | -| oneflow.addmm | [oneflow.Tensor.addmm](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L992) | [addmm](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_addmm.py#L60) | | -| oneflow.any | | [any_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_logical_reduce.py#L47) | | -| oneflow.arange | [oneflow.arange](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/arange.py#L20) | [arange](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_arange.py#L58) | | -| oneflow.arccos | [oneflow.Tensor.arccos](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L485) | [arccos_flow_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_math_ops.py#L338) | | -| oneflow.arccosh | [oneflow.Tensor.arccosh](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L499) | [arccosh_flow_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_math_ops.py#L358) | | -| oneflow.arcsin | [oneflow.Tensor.arcsin](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1013) | | | -| oneflow.arcsinh | [oneflow.Tensor.arcsinh](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1020) | | | -| oneflow.arctan | [oneflow.Tensor.arctanh](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L506) | [arctan_tensor_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_2.py#L440) | | -| oneflow.arctanh | [oneflow.Tensor.arctanh](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L506) | [arctanh_tensor_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_2.py#L462) | | -| oneflow.argmax | [oneflow.argmax](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L139) | [argmax](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_argmax.py#L83) | | -| oneflow.argmin | [oneflow.argmin](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L169) | [argmin](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_argmin.py#L34) | | -| oneflow.argsort | [oneflow.Tensor.argsort](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L527) | [argsort](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_argsort.py#L36) | | -| oneflow.argwhere | [oneflow.Tensor.argwhere](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L534) | [argwhere](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_1.py#L625) | | +| oneflow.add | [oneflow.Tensor.add](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1163) | [padding_idx](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_sparse.py#L140) | [add_inplace_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_binary_functor_exception.py#L27) | +| oneflow.addmm | [oneflow.Tensor.addmm](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1170) | [addmm](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_addmm.py#L60) | | +| oneflow.any | [oneflow.any](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/reduce_ops.py#L219) | [any_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_logical_reduce.py#L52) | | +| oneflow.arange | [oneflow.arange](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/arange.py#L20) | [arange](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_arange.py#L58) | | +| oneflow.arccos | [oneflow.Tensor.arccos](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L642) | [arccos_flow_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_math_ops.py#L338) | | +| oneflow.arccosh | [oneflow.Tensor.arccosh](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L656) | [arccosh_flow_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_math_ops.py#L358) | | +| oneflow.arcsin | [oneflow.Tensor.arcsin](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1205) | | | +| oneflow.arcsinh | [oneflow.Tensor.arcsinh](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1212) | | | +| oneflow.arctan | [oneflow.Tensor.arctanh](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L663) | [arctan_tensor_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_2.py#L438) | | +| oneflow.arctanh | [oneflow.Tensor.arctanh](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L663) | [arctanh_tensor_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_2.py#L460) | | +| oneflow.argmax | [oneflow.argmax](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L139) | [argmax](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_argmax.py#L83) | [argmax_index_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_array_functor.py#L22) | +| oneflow.argmin | [oneflow.argmin](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L169) | [argmin](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_argmin.py#L34) | | +| oneflow.argsort | [oneflow.Tensor.argsort](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L684) | [argsort](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_argsort.py#L37) | | +| oneflow.argwhere | [oneflow.Tensor.argwhere](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L691) | [argwhere](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_1.py#L672) | | | oneflow.as_strided | | | | | oneflow.as_tensor | | | | -| oneflow.asin | [oneflow.Tensor.asin](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1006) | | | -| oneflow.asinh | [oneflow.asinh](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L298) | | | -| oneflow.atan | [oneflow.Tensor.atan2](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L122) | [atanh_tensor_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_2.py#L412) | | -| oneflow.atan2 | [oneflow.Tensor.atan2](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L122) | | | -| oneflow.atanh | [oneflow.Tensor.atanh](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L541) | [atanh_tensor_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_2.py#L412) | | -| oneflow.autograd | | [autograd_interface](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_autograd.py#L81) | | +| oneflow.asin | [oneflow.Tensor.asin](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1198) | | | +| oneflow.asinh | [oneflow.asinh](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L318) | | | +| oneflow.atan | [oneflow.atan2](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/trigonometric_ops.py#L21) | [atanh_tensor_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_2.py#L410) | | +| oneflow.atan2 | [oneflow.atan2](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/trigonometric_ops.py#L21) | | | +| oneflow.atanh | [oneflow.Tensor.atanh](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L698) | [atanh_tensor_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_2.py#L410) | | +| oneflow.autograd | | [autograd_interface](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_autograd.py#L81) | | | oneflow.batch_gather | | | | -| oneflow.bernoulli | [oneflow.bernoulli](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/random.py#L20) | [bernoulli](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_bernoulli.py#L49) | | +| oneflow.bernoulli | [oneflow.bernoulli](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/random.py#L20) | [bernoulli](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_bernoulli.py#L49) | | | oneflow.bfloat16 | | | | -| oneflow.bmm | [oneflow.Tensor.bmm](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L695) | [bmm](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_bmm.py#L93) | | -| oneflow.bool | | [bool_add](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_add.py#L212) | | +| oneflow.bmm | [oneflow.bmm](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/bmm.py#L20) | [bmm](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_bmm.py#L93) | [bmm_exception_dim_not_right](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_bmm.py#L25) | +| oneflow.bool | | [bool_add](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_add.py#L212) | | | oneflow.boxing | | | | | oneflow.broadcast_like | | | | -| oneflow.cast | [oneflow.broadcast_like](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/broadcast_like.py#L20) | [cast](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_flatten.py#L63) | | -| oneflow.cat | [oneflow.cat](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L333) | [scatter_1n4d](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_comm_ops.py#L84) | | -| oneflow.ceil | [oneflow.Tensor.ceil](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1440) | [ceil_flow_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_ceil.py#L29) | | +| oneflow.cast | [oneflow.Tensor.cast](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L901) | [broadcast_mul](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_mul.py#L193) | [broadcast_like_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_array_functor.py#L28) | +| oneflow.cat | [oneflow.cat](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L333) | [scatter_nd](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_scatter_nd.py#L56) | [concat_index_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_array_functor.py#L37) | +| oneflow.ceil | [oneflow.Tensor.ceil](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1653) | [ceil_flow_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_ceil.py#L29) | | | oneflow.char | | | | -| oneflow.chunk | [oneflow.Tensor.chunk](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L702) | | | -| oneflow.clamp | [oneflow.Tensor.clamp](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1266) | [clamp](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_clamp.py#L96) | | +| oneflow.chunk | [oneflow.Tensor.chunk](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L859) | [chunk](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_chunk.py#L37) | [chunk_index_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_array_functor.py#L254) | +| oneflow.clamp | [oneflow.clamp](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/clamp.py#L20) | [clamp](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_clamp.py#L96) | | | oneflow.clamp_ | | | | -| oneflow.clip | [oneflow.Tensor.clip](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1280) | [clip_grad](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_clip_grad.py#L152) | | +| oneflow.clip | [oneflow.clip](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/clamp.py#L70) | [clip_grad](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_clip_grad.py#L152) | | | oneflow.clip_ | | | | -| oneflow.concat | | [concat](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_concat.py#L124) | | +| oneflow.concat | | [concat](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_concat.py#L124) | [concat_index_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_array_functor.py#L37) | | oneflow.constant_initializer | | | | | oneflow.convert_oneflow_dtype_to_numpy_dtype | | | | -| oneflow.cos | [oneflow.Tensor.acos](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L478) | [cos](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_math_ops.py#L88) | | -| oneflow.cosh | [oneflow.Tensor.acosh](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L492) | [arccosh_flow_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_math_ops.py#L358) | | -| oneflow.cumprod | [oneflow.cumprod](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L1576) | [cumprod](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_cum_ops.py#L37) | | -| oneflow.cumsum | [oneflow.cumsum](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L1543) | [cumsum](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_cumsum.py#L36) | | -| oneflow.device | [oneflow.Tensor.device](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L84) | | | -| oneflow.diag | [oneflow.diagonal](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L20) | [diag](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_diag.py#L35) | | -| oneflow.diagonal | [oneflow.diagonal](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L20) | [diagonal](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_diagonal.py#L43) | | +| oneflow.cos | [oneflow.Tensor.acos](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L635) | [cos](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_math_ops.py#L88) | [cosine_similarity_not_floating_type](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_cosine_similarity.py#L24) | +| oneflow.cosh | [oneflow.Tensor.acosh](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L649) | [arccosh_flow_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_math_ops.py#L358) | | +| oneflow.cumprod | [oneflow.cumprod](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L1723) | [cumprod](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_cum_ops.py#L38) | | +| oneflow.cumsum | [oneflow.cumsum](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L1690) | [cumsum](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_cumsum.py#L37) | | +| oneflow.device | [oneflow.Tensor.device](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L85) | | [device_type](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_device.py#L25) | +| oneflow.diag | [oneflow.diagonal](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L20) | [diag](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_diag.py#L35) | [diagonal_index_error1](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_array_functor.py#L204) | +| oneflow.diagonal | [oneflow.diagonal](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L20) | [diagonal](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_diagonal.py#L44) | [diagonal_index_error1](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_array_functor.py#L204) | | oneflow.distributed_partial_fc_sample | | | | -| oneflow.div | [oneflow.Tensor.div_](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L893) | [div](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_1.py#L478) | | +| oneflow.div | [oneflow.Tensor.div_](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1071) | [div](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_1.py#L501) | [div_inplace_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_binary_functor_exception.py#L63) | | oneflow.div_ | | | | -| oneflow.dot | [oneflow.dot](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L1262) | [dot](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_dot.py#L26) | | -| oneflow.double | [oneflow.Tensor.double](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1673) | [double](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_tensor_ops.py#L128) | | +| oneflow.dot | [oneflow.dot](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L1370) | [tensordot_intdim](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_tensordot.py#L28) | [tensordot_neg_dims_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_tensordot.py#L25) | +| oneflow.double | [oneflow.Tensor.double](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1936) | [double](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_tensor_ops.py#L200) | | | oneflow.dtype | | | | | oneflow.dtypes | | | | -| oneflow.einsum | [oneflow.einsum](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/einsum.py#L20) | [einsum_bilinear_transformation](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_einsum_bilinear_transformation.py#L42) | | -| oneflow.empty | | [empty_consistent](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_empty.py#L54) | | -| oneflow.eq | [oneflow.Tensor.requires_grad](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L621) | [eq_with_0_size_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_eq.py#L32) | | +| oneflow.einsum | [oneflow.einsum](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/einsum.py#L20) | [einsum_alphaflod_usecase11](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_einsum_alphaflod_usecase11.py#L38) | | +| oneflow.empty | | [empty_consistent](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_empty.py#L76) | | +| oneflow.eq | [oneflow.Tensor.requires_grad](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L778) | [eq](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_eq.py#L38) | | | oneflow.equal | | | | -| oneflow.erf | [oneflow.Tensor.erf](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L763) | [erf](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_erf.py#L35) | | -| oneflow.erfc | [oneflow.Tensor.erfc](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L772) | [erfc](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_erfc.py#L35) | | -| oneflow.erfinv | [oneflow.Tensor.erfinv](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L781) | [erfinv_tensor_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_2.py#L702) | | +| oneflow.erf | [oneflow.Tensor.erf](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L941) | [erf](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_erf.py#L35) | | +| oneflow.erfc | [oneflow.Tensor.erfc](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L950) | [erfc](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_erfc.py#L35) | | +| oneflow.erfinv | [oneflow.Tensor.erfinv](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L959) | [erfinv_tensor_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_2.py#L700) | | | oneflow.erfinv_ | | | | -| oneflow.exp | [oneflow.Tensor.expand](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L129) | [expand_broadcast](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_expand_op.py#L208) | | -| oneflow.expand | [oneflow.Tensor.expand](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L129) | [expand_broadcast](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_expand_op.py#L208) | | -| oneflow.expm1 | [oneflow.Tensor.expm1](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1447) | [expm1](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_expm1.py#L46) | | -| oneflow.eye | [oneflow.eye](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L1382) | [eye](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_eye.py#L50) | | -| oneflow.flatten | [oneflow.Tensor.flatten](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L154) | [flatten](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_flatten.py#L38) | | -| oneflow.flip | [oneflow.Tensor.flip](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L168) | [flip](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_flip.py#L40) | | -| oneflow.float | [oneflow.Tensor.float](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1652) | [float](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_tensor_ops.py#L114) | | +| oneflow.exp | [oneflow.Tensor.expand](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L130) | [expm1](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_expm1.py#L35) | [expand_dim_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_array_functor.py#L78) | +| oneflow.expand | [oneflow.Tensor.expand](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L130) | [expand_compare_with_numpy](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_expand.py#L206) | [expand_dim_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_array_functor.py#L78) | +| oneflow.expm1 | [oneflow.Tensor.expm1](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1660) | [expm1](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_expm1.py#L35) | | +| oneflow.eye | [oneflow.eye](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L1529) | [eye](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_eye.py#L50) | | +| oneflow.flatten | [oneflow.flatten](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/flatten.py#L20) | [flatten_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_flatten.py#L71) | | +| oneflow.flip | [oneflow.Tensor.flip](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L169) | [flip](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_flip.py#L40) | | +| oneflow.float | [oneflow.Tensor.float](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1915) | [float](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_tensor_ops.py#L186) | | | oneflow.float16 | | | | | oneflow.float32 | | | | | oneflow.float64 | | | | -| oneflow.floor | [oneflow.Tensor.floor](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L161) | [floor](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_floor.py#L49) | | +| oneflow.floor | [oneflow.Tensor.floor](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L162) | [floor](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_floor.py#L49) | | | oneflow.floor_ | | | | | oneflow.floor_divide | | | | -| oneflow.fmod | [oneflow.Tensor.fmod](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1370) | [fmod_with_0_size_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_1.py#L832) | | +| oneflow.fmod | [oneflow.Tensor.fmod](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1583) | [fmod_with_0_size_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_1.py#L885) | | | oneflow.from_numpy | | | | -| oneflow.full | | [full_with_random_data_int](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_constant.py#L115) | | -| oneflow.gather | [oneflow.gather](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L367) | [gather_1n4d](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_comm_ops.py#L106) | | +| oneflow.full | | [full_with_random_data_int](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_constant.py#L126) | | +| oneflow.gather | [oneflow.gather](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L367) | [gather_1n4d](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_comm_ops.py#L106) | [gather_index_type_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_array_functor.py#L120) | | oneflow.gather_nd | | | | -| oneflow.ge | [oneflow.gelu](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L74) | [image_normalize](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_image_normalize.py#L75) | | -| oneflow.gelu | [oneflow.gelu](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L74) | [gelu_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L147) | | +| oneflow.ge | [oneflow.arange](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/arange.py#L20) | [generator_manual_seed](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_generator.py#L72) | [get_sbp_with_invalid_axis](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_local_global_convert_error.py#L24) | +| oneflow.gelu | [oneflow.Tensor.gelu](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1017) | [gelu_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L149) | | | oneflow.glorot_normal_initializer | | | | | oneflow.glorot_uniform_initializer | | | | | oneflow.grad_enable | | | | -| oneflow.greater | [oneflow.greater](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/comparison.py#L21) | [greater_equal](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_greater_equal.py#L38) | | +| oneflow.greater | [oneflow.greater](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/comparison.py#L21) | [greater](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_greater.py#L44) | | | oneflow.greater_equal | | | | -| oneflow.gt | [oneflow.Tensor.gt](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L857) | | | -| oneflow.half | | | | -| oneflow.hsplit | [oneflow.hsplit](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L1459) | | | +| oneflow.gt | [oneflow.Tensor.gt](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1035) | | | +| oneflow.half | [oneflow.Tensor.half](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1449) | [half](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_1.py#L1065) | | +| oneflow.hsplit | [oneflow.hsplit](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L1606) | | | | oneflow.in_top_k | | | | | oneflow.index_select | | | | -| oneflow.int | [oneflow.Tensor.int](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1610) | [interpolate](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_interpolate.py#L658) | | +| oneflow.int | [oneflow.Tensor.int](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1873) | [randint](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_randint.py#L99) | | | oneflow.int32 | | | | | oneflow.int64 | | | | | oneflow.int8 | | | | @@ -121,138 +121,137 @@ | oneflow.is_nonzero | | | | | oneflow.is_tensor | | | | | oneflow.kaiming_initializer | | | | -| oneflow.le | [oneflow.tile](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tile.py#L20) | [upsample2d](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_upsample.py#L380) | | +| oneflow.le | [oneflow.tile](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tile.py#L20) | [less_equal](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_less_equal.py#L84) | [reflect_pad_size_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_nn_functor.py#L107) | | oneflow.linalg_flow | | | | | oneflow.linalg_matrix_norm | | | | | oneflow.linalg_norm | | | | | oneflow.linalg_vector_norm | | | | -| oneflow.linspace | | [linspace_int_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_linspace.py#L32) | | -| oneflow.log | [oneflow.Tensor.logical_not](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L355) | [logical_slice_assign](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_slice.py#L171) | | -| oneflow.log1p | [oneflow.Tensor.log1p](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L864) | [log1p_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_log1p.py#L31) | | -| oneflow.log2 | [oneflow.log2](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L928) | | | +| oneflow.linspace | | [linspace_int_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_linspace.py#L32) | | +| oneflow.log | [oneflow.Tensor.logical_not](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L512) | [logical_or](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_logical_or.py#L58) | | +| oneflow.log1p | [oneflow.Tensor.log1p](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1042) | [log1p_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_log1p.py#L31) | | +| oneflow.log2 | [oneflow.log2](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L948) | [log2_tensor_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_1.py#L808) | | | oneflow.log_softmax | | | | | oneflow.logical_and | | | | | oneflow.logical_not | | | | | oneflow.logical_or | | | | -| oneflow.logical_slice | | | | -| oneflow.logical_slice_assign | | | | | oneflow.logical_xor | | | | -| oneflow.long | [oneflow.Tensor.long](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1631) | [long](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_tensor_ops.py#L86) | | -| oneflow.lt | [oneflow.Tensor.lt](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L802) | [multistep_lr](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_lr_scheduler.py#L160) | | +| oneflow.long | [oneflow.Tensor.long](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1894) | [long](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_tensor_ops.py#L144) | | +| oneflow.lt | [oneflow.Tensor.lt](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L980) | [multi_input](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_autograd_function.py#L54) | [multi_input_with_diff_device](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_multi_input_with_diff_device_or_placement.py#L27) | | oneflow.manual_seed | | | | | oneflow.masked_fill | | | | | oneflow.masked_select | | | | -| oneflow.matmul | [oneflow.Tensor.matmul](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L443) | [matmul](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_matmul.py#L42) | | -| oneflow.max | [oneflow.argmax](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L139) | [maxpool](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_maxpool.py#L219) | | -| oneflow.maximum | [oneflow.maximum](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L977) | [maximum_minimum_with_same_input](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_maximum_minimum.py#L93) | | -| oneflow.mean | [oneflow.Tensor.mean](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1504) | [mean](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_mean.py#L33) | | -| oneflow.meshgrid | [oneflow.meshgrid](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/meshgrid.py#L20) | [meshgrid](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_meshgrid.py#L68) | | -| oneflow.min | [oneflow.argmin](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L169) | [min_max_observer](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_min_max_observer.py#L136) | | -| oneflow.minimum | [oneflow.minimum](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L955) | | | -| oneflow.mish | [oneflow.mish](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L254) | [mish_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L182) | | -| oneflow.movedim | [oneflow.movedim](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L1320) | [movedim](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_movedim.py#L37) | | -| oneflow.mul | [oneflow.Tensor.matmul](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L443) | [mul_with_scalar](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_mul.py#L47) | | -| oneflow.narrow | [oneflow.Tensor.narrow](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L450) | [narrow](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_narrow.py#L34) | | -| oneflow.ne | [oneflow.decode_onerec](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/dataset.py#L20) | [ones_like](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_ones_like.py#L53) | | -| oneflow.neg | [oneflow.Tensor.negative](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L907) | [negative_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_negative.py#L42) | | -| oneflow.negative | [oneflow.Tensor.negative](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L907) | [negative_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_negative.py#L42) | | +| oneflow.matmul | [oneflow.Tensor.matmul](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L600) | [matmul](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_matmul.py#L42) | [matmul_dimension_error1](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_nn_functor.py#L220) | +| oneflow.max | [oneflow.max](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/reduce_ops.py#L20) | [maxpool1d_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_maxpool.py#L155) | [argmax_index_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_array_functor.py#L22) | +| oneflow.maximum | [oneflow.maximum](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L997) | [maximum_minimum_with_same_input](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_maximum_minimum.py#L93) | | +| oneflow.mean | [oneflow.mean](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/reduce_ops.py#L123) | [mean](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_mean.py#L33) | | +| oneflow.meshgrid | [oneflow.meshgrid](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/meshgrid.py#L20) | [meshgrid](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_meshgrid.py#L68) | [meshgrid_tensors_scalar_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_array_functor.py#L276) | +| oneflow.min | [oneflow.min](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/reduce_ops.py#L56) | [argmin](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_argmin.py#L34) | | +| oneflow.minimum | [oneflow.minimum](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L975) | | | +| oneflow.mish | [oneflow.Tensor.mish](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1049) | [mish_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L189) | | +| oneflow.movedim | [oneflow.movedim](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L1428) | [movedim](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_movedim.py#L37) | | +| oneflow.mul | [oneflow.Tensor.matmul](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L600) | [mul_with_scalar](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_mul.py#L47) | [matmul_dimension_error1](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_nn_functor.py#L220) | +| oneflow.narrow | [oneflow.narrow](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor_ops.py#L20) | [narrow](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_narrow.py#L35) | [narrow_dim_index_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_array_functor.py#L178) | +| oneflow.ne | [oneflow.comm.send](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/comm.py#L20) | [generator_manual_seed](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_generator.py#L72) | [onehot_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_nn_functor.py#L375) | +| oneflow.neg | [oneflow.Tensor.negative](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1085) | [negative](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_negative.py#L31) | | +| oneflow.negative | [oneflow.Tensor.negative](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1085) | [negative](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_negative.py#L31) | | | oneflow.new_ones | | | | -| oneflow.nms | [oneflow.Tensor.nms](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1461) | [nms](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_nms.py#L91) | | +| oneflow.nms | [oneflow.Tensor.nms](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1674) | [nms](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_nms.py#L50) | | | oneflow.no_grad | | | | -| oneflow.nonzero | [oneflow.nonzero](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/nonzero.py#L20) | [nonzero](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_nozero.py#L31) | | +| oneflow.nonzero | [oneflow.Tensor.nonzero](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1681) | [nonzero](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_nozero.py#L31) | | | oneflow.not_equal | | | | -| oneflow.numel | [oneflow.Tensor.numel](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L193) | | | +| oneflow.numel | [oneflow.Tensor.numel](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L194) | | | | oneflow.one_embedding | | | | -| oneflow.ones | [oneflow.ones_like](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/constant.py#L20) | [ones_like](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_ones_like.py#L53) | | +| oneflow.ones | [oneflow.ones_like](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/constant.py#L20) | [ones_like](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_ones_like.py#L53) | | | oneflow.ones_initializer | | | | | oneflow.ones_like | | | | -| oneflow.pad | | [ConstantPad2d](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_zeropad2d.py#L96) | | -| oneflow.permute | [oneflow.Tensor.permute](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L464) | [permute4d_tensor_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_contiguous.py#L69) | | -| oneflow.placement | [oneflow.Tensor.placement](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L94) | | | -| oneflow.pow | [oneflow.Tensor.pow](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L950) | [pow_float_scalar_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_math_ops.py#L163) | | -| oneflow.prod | [oneflow.Tensor.prod](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1513) | [cumprod](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_cum_ops.py#L37) | | -| oneflow.randint | | [randint_consistent](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_randint.py#L56) | | -| oneflow.randn | | [randn](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_randn.py#L86) | | +| oneflow.pad | | [padding_idx](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_sparse.py#L140) | [pad_size_attribute_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_nn_functor.py#L89) | +| oneflow.permute | [oneflow.permute](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor_ops.py#L82) | [permute2d_tensor_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_contiguous.py#L40) | | +| oneflow.placement | [oneflow.Tensor.placement](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L95) | | | +| oneflow.pow | [oneflow.Tensor.pow](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1128) | [pow_float_scalar_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_math_ops.py#L163) | | +| oneflow.prod | [oneflow.prod](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/reduce_ops.py#L154) | [cumprod](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_cum_ops.py#L38) | | +| oneflow.randint | | [randint](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_randint.py#L99) | | +| oneflow.randn | | [randn](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_randn.py#L102) | | | oneflow.random_normal_initializer | | | | | oneflow.random_uniform_initializer | | | | -| oneflow.randperm | | [randperm](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_randperm.py#L86) | | -| oneflow.reciprocal | [oneflow.Tensor.reciprocal](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L978) | | | -| oneflow.relu | [oneflow.relu](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L50) | [prelu_4dim_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_prelu.py#L32) | | -| oneflow.repeat | [oneflow.Tensor.repeat](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1334) | | | -| oneflow.reshape | [oneflow.Tensor.reshape](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1522) | [reshape](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_reshape.py#L59) | [reshape_exception_only_one_dim_infered](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/exceptions/test_reshape.py#L25) | +| oneflow.randperm | | [randperm](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_randperm.py#L86) | | +| oneflow.reciprocal | [oneflow.Tensor.reciprocal](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1156) | | | +| oneflow.relu | [oneflow.Tensor.relu](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1135) | [relu_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L124) | [relu_inplace_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_activation.py#L29) | +| oneflow.repeat | [oneflow.Tensor.repeat](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1538) | | [repeat_interleave_index_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_repeat_interleave.py#L25) | +| oneflow.reshape | [oneflow.Tensor.reshape](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1753) | [reshape](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_reshape.py#L86) | [reshape_exception_only_one_dim_infered](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_reshape.py#L25) | | oneflow.roi_align | | | | -| oneflow.roll | [oneflow.Tensor.roll](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L964) | | | -| oneflow.round | [oneflow.Tensor.round](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L971) | [round_tensor_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_2.py#L724) | | -| oneflow.rsqrt | [oneflow.Tensor.rsqrt](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1064) | [rsqrt_flow_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_math_ops.py#L136) | | -| oneflow.save | | [save_state_dict](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_module.py#L179) | | -| oneflow.sbp | [oneflow.Tensor.sbp](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L101) | [sbp_symbol](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_sbp_symbol.py#L23) | | -| oneflow.scatter | | [scatter_1n4d](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_comm_ops.py#L84) | | +| oneflow.roll | [oneflow.Tensor.roll](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1142) | | [roll_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_array_functor.py#L112) | +| oneflow.round | [oneflow.Tensor.round](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1149) | [round_tensor_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_2.py#L722) | | +| oneflow.rsqrt | [oneflow.Tensor.rsqrt](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1256) | [rsqrt_flow_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_math_ops.py#L136) | | +| oneflow.save | | [save_state_dict](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_module.py#L179) | | +| oneflow.sbp | [oneflow.Tensor.sbp](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L102) | [sbp_symbol](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_sbp_symbol.py#L23) | | +| oneflow.scatter | | [scatter_nd](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_scatter_nd.py#L56) | | | oneflow.scatter_add | | | | -| oneflow.select | [oneflow.select](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L1291) | | | -| oneflow.selu | [oneflow.selu](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L396) | [selu_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L192) | | +| oneflow.select | [oneflow.select](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L1399) | | [ApplySelectIndexing_input_dim_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_tensor_index.py#L37) | +| oneflow.selu | [oneflow.Tensor.selu](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1284) | [selu_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L199) | | | oneflow.set_num_threads | | | | | oneflow.set_printoptions | | | | | oneflow.set_rng_state | | | | -| oneflow.sigmoid | [oneflow.sigmoid](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L325) | [sigmoid_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L152) | | -| oneflow.sign | [oneflow.Tensor.sign](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1106) | [sign](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_sign.py#L45) | | -| oneflow.silu | [oneflow.silu](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L224) | [silu_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L187) | | -| oneflow.sin | [oneflow.Tensor.asin](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1006) | [cosine_decay_lr](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_lr_scheduler.py#L82) | | +| oneflow.sigmoid | [oneflow.Tensor.sigmoid](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1291) | [sigmoid_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L154) | | +| oneflow.sign | [oneflow.Tensor.sign](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1298) | [sign](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_sign.py#L45) | | +| oneflow.silu | [oneflow.Tensor.silu](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1305) | [silu_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L194) | | +| oneflow.sin | [oneflow.Tensor.asin](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1198) | [cosine_decay_lr](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_lr_scheduler.py#L82) | [cosine_similarity_not_floating_type](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_cosine_similarity.py#L24) | | oneflow.sin_ | | | | -| oneflow.sinh | [oneflow.Tensor.arcsinh](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1020) | | | -| oneflow.slice | | [slice](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_slice.py#L133) | | -| oneflow.softmax | [oneflow.Tensor.softmax](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1141) | [softmax_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_activation.py#L395) | | -| oneflow.softplus | [oneflow.softplus](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L133) | [softplus](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_activation.py#L502) | | -| oneflow.softshrink | | [softshrink_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L207) | | -| oneflow.softsign | [oneflow.Tensor.softsign](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1155) | [softsign_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_activation.py#L685) | | -| oneflow.sort | [oneflow.sort](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/sort.py#L20) | [argsort](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_argsort.py#L36) | | -| oneflow.split | [oneflow.Tensor.split](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L709) | | | -| oneflow.sqrt | [oneflow.Tensor.sqrt](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L363) | [sqrt_sum_with_cpu_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_sqrt_square_sum.py#L48) | | -| oneflow.square | [oneflow.Tensor.square](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L370) | [square_flow_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_math_ops.py#L146) | | -| oneflow.squeeze | [oneflow.squeeze](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L303) | [squeeze_1d_input](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_squeeze.py#L51) | | -| oneflow.stack | [oneflow.stack](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L272) | [stack_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_stack.py#L28) | | +| oneflow.sinh | [oneflow.Tensor.arcsinh](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1212) | | | +| oneflow.slice | | [slice](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_slice.py#L151) | [PrepareSliceIndices_indices_amount_index_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_tensor_index.py#L22) | +| oneflow.slice_update | | | | +| oneflow.softmax | [oneflow.Tensor.softmax](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1333) | [softmax_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_activation.py#L415) | [softmax_index_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_activation.py#L109) | +| oneflow.softplus | [oneflow.Tensor.softplus](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1340) | [softplus_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L209) | | +| oneflow.softshrink | | [softshrink_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L214) | | +| oneflow.softsign | [oneflow.Tensor.softsign](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1347) | [softsign_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_activation.py#L710) | | +| oneflow.sort | [oneflow.Tensor.argsort](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L684) | [argsort](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_argsort.py#L37) | | +| oneflow.split | [oneflow.Tensor.split](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L866) | | [split_index_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_array_functor.py#L224) | +| oneflow.sqrt | [oneflow.Tensor.sqrt](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L520) | [sqrt_flow_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_math_ops.py#L109) | | +| oneflow.square | [oneflow.Tensor.square](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L527) | [square_flow_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_math_ops.py#L146) | | +| oneflow.squeeze | [oneflow.unsqueeze](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor_ops.py#L50) | [unsqueeze](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_unsqueeze.py#L68) | [squeeze_index_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_array_functor.py#L106) | +| oneflow.stack | [oneflow.stack](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L272) | [stack_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_stack.py#L28) | [stack_index_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_array_functor.py#L62) | | oneflow.stateful_op | | | | -| oneflow.std | [oneflow.Tensor.std](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L377) | [std_flow_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_std.py#L26) | | -| oneflow.sub | [oneflow.Tensor.sub_](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L900) | [sub](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_sub.py#L96) | | -| oneflow.sum | [oneflow.einsum](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/einsum.py#L20) | [einsum_bilinear_transformation](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_einsum_bilinear_transformation.py#L42) | | +| oneflow.std | [oneflow.Tensor.std](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L534) | [std_flow_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_std.py#L26) | | +| oneflow.sub | [oneflow.Tensor.sub_](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1078) | [sub](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_sub.py#L96) | | +| oneflow.sum | [oneflow.sum](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/reduce_ops.py#L92) | [einsum_alphaflod_usecase11](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_einsum_alphaflod_usecase11.py#L38) | | | oneflow.support | | | | -| oneflow.swapaxes | [oneflow.swapaxes](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/swapaxes.py#L20) | [swapaxes_flow_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_swapaxes.py#L32) | | -| oneflow.t | [oneflow.nn.functional.layer_norm](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/normalization.py#L20) | [cast](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_flatten.py#L63) | | -| oneflow.tan | [oneflow.tanh](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L150) | [ConstantPad2d](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_zeropad2d.py#L96) | | -| oneflow.tanh | [oneflow.tanh](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L150) | [tanh_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L132) | | +| oneflow.swapaxes | [oneflow.Tensor.swapaxes](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L880) | [swapaxes_flow_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_swapaxes.py#L31) | | +| oneflow.t | [oneflow.permute](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor_ops.py#L82) | [greter_equal](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_greater_equal.py#L88) | [repeat_interleave_index_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_repeat_interleave.py#L25) | +| oneflow.tan | [oneflow.atan2](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/trigonometric_ops.py#L21) | [constant_warmup_cosine_annealing](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_lr_scheduler.py#L446) | | +| oneflow.tanh | [oneflow.Tensor.arctanh](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L663) | [tanh_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L134) | | | oneflow.tensor_buffer | | | | | oneflow.tensor_buffer_to_list_of_tensors | | | | | oneflow.tensor_buffer_to_tensor | | | | | oneflow.tensor_scatter_nd_update | | | | | oneflow.tensor_split | | | | | oneflow.tensor_to_tensor_buffer | | | | -| oneflow.tile | [oneflow.tile](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tile.py#L20) | | | +| oneflow.tile | [oneflow.tile](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tile.py#L20) | | [tile_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_array_functor.py#L431) | | oneflow.to_global | | | | | oneflow.to_local | | | | -| oneflow.topk | [oneflow.topk](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/topk.py#L20) | | | -| oneflow.transpose | [oneflow.transpose](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L245) | [transpose](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_transpose.py#L86) | | -| oneflow.tril | [oneflow.tril](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L84) | [tril_without_diag](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_tril.py#L26) | | -| oneflow.triu | [oneflow.triu](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L114) | [triu](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_triu.py#L47) | | +| oneflow.topk | [oneflow.Tensor.topk](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1667) | | | +| oneflow.transpose | [oneflow.transpose](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L245) | [transpose_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_contiguous.py#L32) | | +| oneflow.tril | [oneflow.tril](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L84) | [tril_without_diag](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_tril.py#L26) | | +| oneflow.triu | [oneflow.triu](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L114) | [triu](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_triu.py#L47) | | | oneflow.truncated_normal_initializer | | | | | oneflow.uint8 | | | | -| oneflow.unsqueeze | [oneflow.Tensor.unsqueeze](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L457) | [unsqueeze_with_0_size_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_unsqueeze.py#L88) | | -| oneflow.var | [oneflow.Tensor.var](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L384) | | | +| oneflow.unsqueeze | [oneflow.unsqueeze](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor_ops.py#L50) | [unsqueeze](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_unsqueeze.py#L68) | | +| oneflow.var | [oneflow.Tensor.var](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L541) | | | | oneflow.variance_scaling_initializer | | | | | oneflow.version | | | | -| oneflow.view | [oneflow.Tensor.view](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1529) | [view](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_view.py#L78) | | -| oneflow.vsplit | [oneflow.vsplit](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L1502) | | | -| oneflow.where | [oneflow.Tensor.argwhere](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L534) | [argwhere](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_1.py#L625) | | +| oneflow.view | [oneflow.Tensor.view](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1776) | [view](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_view.py#L79) | [view_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_array_functor.py#L166) | +| oneflow.vsplit | [oneflow.vsplit](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/math_ops.py#L1649) | | | +| oneflow.where | [oneflow.Tensor.argwhere](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L691) | [where](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_where.py#L196) | | | oneflow.xavier_normal_initializer | | | | | oneflow.xavier_uniform_initializer | | | | | oneflow.zero_ | | | | -| oneflow.zeros | [oneflow.zeros_like](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/constant.py#L43) | [zeros_](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_1.py#L908) | | +| oneflow.zeros | [oneflow.zeros_like](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/constant.py#L43) | [zeros_](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/tensor/test_tensor_part_1.py#L944) | | | oneflow.zeros_initializer | | | | | oneflow.zeros_like | | | | -| oneflow.optim.Adagrad | | [adagrad](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_optim_adagrad.py#L197) | | -| oneflow.optim.Adam | | [adam](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_optim_adam.py#L241) | | -| oneflow.optim.AdamW | | [adamw](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_optim_adamw.py#L244) | | -| oneflow.optim.LAMB | | [lambda_lr](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_lr_scheduler.py#L199) | | -| oneflow.optim.RMSprop | | [rmsprop](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_optim_rmsprop.py#L228) | | -| oneflow.optim.SGD | | [sgd](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_optim_sgd.py#L194) | | +| oneflow.optim.Adagrad | | [adagrad](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_optim_adagrad.py#L197) | | +| oneflow.optim.Adam | | [adamw](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_optim_adamw.py#L244) | | +| oneflow.optim.AdamW | | [adamw](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_optim_adamw.py#L244) | | +| oneflow.optim.LAMB | | [lambda_lr](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_lr_scheduler.py#L199) | | +| oneflow.optim.RMSprop | | [rmsprop](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_optim_rmsprop.py#L228) | | +| oneflow.optim.SGD | | [sgd](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_optim_sgd.py#L194) | | | oneflow.optim.lr_scheduler.ChainedScheduler | | | | | oneflow.optim.lr_scheduler.ConstantLR | | | | | oneflow.optim.lr_scheduler.CosineAnnealingLR | | | | @@ -271,96 +270,96 @@ | oneflow.nn.AdaptiveAvgPool2d | | | | | oneflow.nn.AdaptiveAvgPool3d | | | | | oneflow.nn.AllReduce | | | | -| oneflow.nn.AvgPool1d | | [avgpool1d_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_avgpool.py#L28) | | -| oneflow.nn.AvgPool2d | | [avgpool2d_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_avgpool.py#L44) | | -| oneflow.nn.AvgPool3d | | [avgpool3d_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_avgpool.py#L61) | | +| oneflow.nn.AvgPool1d | | [avgpool1d_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_avgpool.py#L28) | | +| oneflow.nn.AvgPool2d | | [avgpool2d_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_avgpool.py#L44) | | +| oneflow.nn.AvgPool3d | | [avgpool3d_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_avgpool.py#L61) | | | oneflow.nn.BCELoss | | | | | oneflow.nn.BCEWithLogitsLoss | | | | -| oneflow.nn.BatchNorm1d | | [batchnorm1d_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_batchnorm.py#L32) | | -| oneflow.nn.BatchNorm2d | | [batchnorm2d_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_batchnorm.py#L48) | | -| oneflow.nn.BatchNorm3d | | [batchnorm3d_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_batchnorm.py#L64) | | -| oneflow.nn.CELU | | [celu_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L142) | | +| oneflow.nn.BatchNorm1d | | [batchnorm1d_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_batchnorm.py#L34) | | +| oneflow.nn.BatchNorm2d | | [batchnorm2d_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_batchnorm.py#L52) | | +| oneflow.nn.BatchNorm3d | | [batchnorm3d_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_batchnorm.py#L70) | | +| oneflow.nn.CELU | | [celu_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L144) | [celu_inplace_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_activation.py#L47) | | oneflow.nn.COCOReader | | | | -| oneflow.nn.CTCLoss | | | | +| oneflow.nn.CTCLoss | | | [ctcloss_reduction_type_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_nn_functor.py#L62) | | oneflow.nn.CoinFlip | | | | | oneflow.nn.CombinedMarginLoss | | | | -| oneflow.nn.ConstantPad1d | | [constantpad1d_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_constantpad.py#L32) | | -| oneflow.nn.ConstantPad2d | | [ConstantPad2d](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_zeropad2d.py#L96) | | -| oneflow.nn.ConstantPad3d | | [constantpad3d_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_constantpad.py#L64) | | -| oneflow.nn.Conv1d | | [conv1d](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_conv1d.py#L422) | | -| oneflow.nn.Conv2d | | [deconv2d](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_deconv2d.py#L68) | | -| oneflow.nn.Conv3d | | [conv3d_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_conv3d.py#L26) | | +| oneflow.nn.ConstantPad1d | | [constantpad1d_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_constantpad.py#L32) | | +| oneflow.nn.ConstantPad2d | | [ConstantPad2d](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_zeropad2d.py#L96) | | +| oneflow.nn.ConstantPad3d | | [constantpad3d_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_constantpad.py#L64) | | +| oneflow.nn.Conv1d | | [conv1d](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_conv1d.py#L422) | | +| oneflow.nn.Conv2d | | [conv2d_default_init](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_conv2d.py#L1568) | | +| oneflow.nn.Conv3d | | | | | oneflow.nn.ConvTranspose1d | | | | | oneflow.nn.ConvTranspose2d | | | | | oneflow.nn.ConvTranspose3d | | | | | oneflow.nn.CropMirrorNormalize | | | | | oneflow.nn.CrossEntropyLoss | | | | | oneflow.nn.DistributedPariticalFCSample | | | | -| oneflow.nn.Dropout | | [dropout_numpy_case](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_dropout.py#L239) | | -| oneflow.nn.ELU | [oneflow.relu](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L50) | [prelu_4dim_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_prelu.py#L32) | | -| oneflow.nn.Embedding | | [embedding](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_sparse.py#L152) | | +| oneflow.nn.Dropout | | [dropout_p01](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_dropout.py#L44) | | +| oneflow.nn.ELU | [oneflow.Tensor.gelu](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1017) | [relu_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L124) | [relu_inplace_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_activation.py#L29) | +| oneflow.nn.Embedding | | [embedding](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_sparse.py#L45) | | | oneflow.nn.FakeQuantization | | | | -| oneflow.nn.Flatten | [oneflow.Tensor.flatten](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L154) | [flatten](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_flatten.py#L38) | | -| oneflow.nn.Fold | [oneflow.Tensor.unfold](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L398) | [fold](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_fold.py#L45) | | +| oneflow.nn.Flatten | [oneflow.flatten](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/flatten.py#L20) | [flatten_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_flatten.py#L71) | | +| oneflow.nn.Fold | [oneflow.Tensor.unfold](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L555) | [fold_with_random_data_1](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_fold.py#L28) | | | oneflow.nn.FusedBatchNorm1d | | | | | oneflow.nn.FusedBatchNorm2d | | | | | oneflow.nn.FusedBatchNorm3d | | | | | oneflow.nn.FusedMLP | | | | -| oneflow.nn.GELU | [oneflow.gelu](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L74) | [gelu_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L147) | | -| oneflow.nn.GLU | | [glu_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_glu.py#L37) | | +| oneflow.nn.GELU | [oneflow.Tensor.gelu](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1017) | [gelu_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L149) | | +| oneflow.nn.GLU | | [glu_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_glu.py#L37) | [glu_scalar_tensor_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_activation.py#L57) | | oneflow.nn.GPTIndexedBinDataReader | | | | -| oneflow.nn.GRU | | | | -| oneflow.nn.GroupNorm | | [groupnorm](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_groupnorm.py#L332) | | -| oneflow.nn.Hardsigmoid | | [hardsigmoid_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L157) | | -| oneflow.nn.Hardswish | | [hardswish_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L167) | | -| oneflow.nn.Hardtanh | | [hardtanh_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L172) | | -| oneflow.nn.Identity | | [identity_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_linear.py#L217) | | +| oneflow.nn.GRU | | [gru_cell](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_rnn_cell.py#L218) | | +| oneflow.nn.GroupNorm | | [groupnorm](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_groupnorm.py#L332) | | +| oneflow.nn.Hardsigmoid | | [hardsigmoid_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L159) | | +| oneflow.nn.Hardswish | | [hardswish_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L174) | | +| oneflow.nn.Hardtanh | | [hardtanh_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L179) | | +| oneflow.nn.Identity | | [identity_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_linear.py#L217) | | | oneflow.nn.InstanceNorm1d | | | | | oneflow.nn.InstanceNorm2d | | | | | oneflow.nn.InstanceNorm3d | | | | | oneflow.nn.KLDivLoss | | | | | oneflow.nn.L1Loss | | | | -| oneflow.nn.LSTM | | | | -| oneflow.nn.LayerNorm | | | | -| oneflow.nn.LeakyReLU | | [leakyrelu_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L177) | | -| oneflow.nn.Linear | | [linear_warmup_exp_lr](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_lr_scheduler.py#L376) | | -| oneflow.nn.LogSigmoid | | [logsigmoid_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L162) | | -| oneflow.nn.LogSoftmax | | [logsoftmax_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_activation.py#L414) | | +| oneflow.nn.LSTM | | [lstm_cell](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_rnn_cell.py#L200) | | +| oneflow.nn.LayerNorm | | | [layernorm_exception_input_shape_not_match](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_layernorm.py#L25) | +| oneflow.nn.LeakyReLU | | [leakyrelu_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L184) | | +| oneflow.nn.Linear | | [linear_forward](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_linear.py#L163) | | +| oneflow.nn.LogSigmoid | | [logsigmoid_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L169) | | +| oneflow.nn.LogSoftmax | | [logsoftmax_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_activation.py#L439) | | | oneflow.nn.MSELoss | | | | | oneflow.nn.MarginRankingLoss | | | | -| oneflow.nn.MaxPool1d | | [maxpool1d_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_maxpool.py#L155) | | -| oneflow.nn.MaxPool2d | | [maxpool2d_channel_last](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_maxpool.py#L135) | | -| oneflow.nn.MaxPool3d | | [maxpool3d_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_maxpool.py#L199) | | +| oneflow.nn.MaxPool1d | | [maxpool1d_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_maxpool.py#L155) | | +| oneflow.nn.MaxPool2d | | [maxpool2d_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_maxpool.py#L177) | | +| oneflow.nn.MaxPool3d | | [maxpool3d_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_maxpool.py#L199) | | | oneflow.nn.MinMaxObserver | | | | -| oneflow.nn.Mish | [oneflow.mish](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L254) | [mish_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L182) | | -| oneflow.nn.Module | [oneflow.nn.Module.to_consistent](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/module.py#L20) | [module_to_global](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_module_to_consistent.py#L30) | | -| oneflow.nn.ModuleDict | | [moduledict](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_module.py#L303) | | +| oneflow.nn.Mish | [oneflow.Tensor.mish](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1049) | [mish_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L189) | | +| oneflow.nn.Module | [oneflow.nn.Module.to_consistent](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/module.py#L20) | [module_to_global](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_module_to_consistent.py#L30) | | +| oneflow.nn.ModuleDict | | [moduledict](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_module.py#L310) | | | oneflow.nn.ModuleList | | | | | oneflow.nn.MovingAverageMinMaxObserver | | | | | oneflow.nn.NLLLoss | | | | -| oneflow.nn.PReLU | | [prelu_4dim_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_prelu.py#L32) | | -| oneflow.nn.Parameter | | [parameter](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_module.py#L98) | | +| oneflow.nn.PReLU | | [prelu_4dim_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_prelu.py#L32) | [prelu_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_activation.py#L38) | +| oneflow.nn.Parameter | | [parameter](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_module.py#L98) | | | oneflow.nn.ParameterDict | | | | | oneflow.nn.ParameterList | | | | | oneflow.nn.PixelShuffle | | | | | oneflow.nn.Quantization | | | | -| oneflow.nn.RNN | | | | -| oneflow.nn.ReLU | [oneflow.relu](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L50) | [prelu_4dim_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_prelu.py#L32) | | -| oneflow.nn.ReLU6 | | [relu6_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L127) | | +| oneflow.nn.RNN | | [rnn_relu_cell](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_rnn_cell.py#L206) | | +| oneflow.nn.ReLU | [oneflow.Tensor.relu](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1135) | [relu_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L124) | [relu_inplace_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_activation.py#L29) | +| oneflow.nn.ReLU6 | | [relu6_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L129) | | | oneflow.nn.ReflectionPad2d | | | | -| oneflow.nn.ReplicationPad2d | | [ReplicationPad2d](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_replicationpad2d.py#L104) | | -| oneflow.nn.SELU | [oneflow.selu](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L396) | [selu_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L192) | | +| oneflow.nn.ReplicationPad2d | | [ReplicationPad2d](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_replicationpad2d.py#L104) | | +| oneflow.nn.SELU | [oneflow.Tensor.selu](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1284) | [selu_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L199) | | | oneflow.nn.Sequential | | | | -| oneflow.nn.SiLU | [oneflow.silu](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L224) | [silu_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L187) | | -| oneflow.nn.Sigmoid | [oneflow.sigmoid](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L325) | [sigmoid_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L152) | | +| oneflow.nn.SiLU | [oneflow.Tensor.silu](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1305) | [silu_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L194) | | +| oneflow.nn.Sigmoid | [oneflow.Tensor.sigmoid](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1291) | [sigmoid_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L154) | | | oneflow.nn.SmoothL1Loss | | | | -| oneflow.nn.Softmax | [oneflow.Tensor.softmax](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1141) | [softmax_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_activation.py#L395) | | -| oneflow.nn.Softplus | [oneflow.softplus](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L133) | [softplus](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_activation.py#L502) | | -| oneflow.nn.Softshrink | | [softshrink_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L207) | | -| oneflow.nn.Softsign | [oneflow.Tensor.softsign](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1155) | [softsign_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_activation.py#L685) | | -| oneflow.nn.Tanh | [oneflow.tanh](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L150) | [tanh_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L132) | | +| oneflow.nn.Softmax | [oneflow.Tensor.softmax](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1333) | [softmax_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_activation.py#L415) | [softmax_index_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_activation.py#L109) | +| oneflow.nn.Softplus | [oneflow.Tensor.softplus](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1340) | [softplus_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L209) | | +| oneflow.nn.Softshrink | | [softshrink_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L214) | | +| oneflow.nn.Softsign | [oneflow.Tensor.softsign](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1347) | [softsign_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_activation.py#L710) | | +| oneflow.nn.Tanh | [oneflow.Tensor.arctanh](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L663) | [tanh_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L134) | | | oneflow.nn.TripletMarginLoss | | | | -| oneflow.nn.Unfold | [oneflow.Tensor.unfold](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L398) | [unfold_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_unfold.py#L42) | | +| oneflow.nn.Unfold | [oneflow.Tensor.unfold](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L555) | [unfold_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_unfold.py#L28) | | | oneflow.nn.UpsamplingBilinear2d | | | | | oneflow.nn.UpsamplingNearest2d | | | | | oneflow.nn.ZeroPad2d | | | | @@ -371,87 +370,87 @@ | oneflow.nn.functional.avg_pool1d | | | | | oneflow.nn.functional.avg_pool2d | | | | | oneflow.nn.functional.avg_pool3d | | | | -| oneflow.nn.functional.celu | | [celu_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L142) | | -| oneflow.nn.functional.conv1d | | [conv1d](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_conv1d.py#L422) | | -| oneflow.nn.functional.conv2d | | [deconv2d](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_deconv2d.py#L68) | | -| oneflow.nn.functional.conv3d | | [conv3d_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_conv3d.py#L26) | | +| oneflow.nn.functional.celu | | [celu_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L144) | [celu_inplace_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_activation.py#L47) | +| oneflow.nn.functional.conv1d | | [conv1d](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_conv1d.py#L422) | | +| oneflow.nn.functional.conv2d | | [conv2d_default_init](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_conv2d.py#L1568) | | +| oneflow.nn.functional.conv3d | | | | | oneflow.nn.functional.cross_entropy | | | | | oneflow.nn.functional.ctc_greedy_decoder | | | | -| oneflow.nn.functional.dropout | | [dropout_numpy_case](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_dropout.py#L239) | | -| oneflow.nn.functional.elu | [oneflow.relu](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L50) | [prelu_4dim_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_prelu.py#L32) | | -| oneflow.nn.functional.embedding | | [embedding](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_sparse.py#L152) | | +| oneflow.nn.functional.dropout | | [dropout_p01](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_dropout.py#L44) | | +| oneflow.nn.functional.elu | [oneflow.Tensor.gelu](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1017) | [relu_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L124) | [relu_inplace_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_activation.py#L29) | +| oneflow.nn.functional.embedding | | [embedding](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_sparse.py#L45) | | | oneflow.nn.functional.functional_maxpool | | | | -| oneflow.nn.functional.gelu | [oneflow.gelu](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L74) | [gelu_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L147) | | -| oneflow.nn.functional.glu | | [glu_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_glu.py#L37) | | +| oneflow.nn.functional.gelu | [oneflow.Tensor.gelu](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1017) | [gelu_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L149) | | +| oneflow.nn.functional.glu | | [glu_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_glu.py#L37) | [glu_scalar_tensor_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_activation.py#L57) | | oneflow.nn.functional.grid_sample | | | | -| oneflow.nn.functional.hardsigmoid | | [hardsigmoid_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L157) | | -| oneflow.nn.functional.hardswish | | [hardswish_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L167) | | -| oneflow.nn.functional.hardtanh | | [hardtanh_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L172) | | -| oneflow.nn.functional.interpolate | | [interpolate](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_interpolate.py#L658) | | +| oneflow.nn.functional.hardsigmoid | | [hardsigmoid_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L159) | | +| oneflow.nn.functional.hardswish | | [hardswish_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L174) | | +| oneflow.nn.functional.hardtanh | | [hardtanh_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L179) | | +| oneflow.nn.functional.interpolate | | [interpolate](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_interpolate.py#L658) | | | oneflow.nn.functional.layer_norm | | | | | oneflow.nn.functional.leaky_relu | | | | -| oneflow.nn.functional.linear | | [linear_warmup_exp_lr](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_lr_scheduler.py#L376) | | +| oneflow.nn.functional.linear | | [linear_forward](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_linear.py#L163) | | | oneflow.nn.functional.log_softmax | | | | -| oneflow.nn.functional.logsigmoid | | [logsigmoid_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L162) | | +| oneflow.nn.functional.logsigmoid | | [logsigmoid_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L169) | | | oneflow.nn.functional.max_pool1d | | | | | oneflow.nn.functional.max_pool2d | | | | | oneflow.nn.functional.max_pool3d | | | | -| oneflow.nn.functional.mish | [oneflow.mish](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L254) | [mish_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L182) | | -| oneflow.nn.functional.normalize | | [normalize_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_normalize.py#L36) | | +| oneflow.nn.functional.mish | [oneflow.Tensor.mish](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1049) | [mish_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L189) | | +| oneflow.nn.functional.normalize | | [normalize_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_normalize.py#L36) | [l2normalize_axis_error1](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_nn_functor.py#L192) | | oneflow.nn.functional.one_hot | | | | -| oneflow.nn.functional.pad | | [ConstantPad2d](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_zeropad2d.py#L96) | | -| oneflow.nn.functional.prelu | | [prelu_4dim_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_prelu.py#L32) | | -| oneflow.nn.functional.relu | [oneflow.relu](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L50) | [prelu_4dim_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_prelu.py#L32) | | -| oneflow.nn.functional.relu6 | | [relu6_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L127) | | -| oneflow.nn.functional.selu | [oneflow.selu](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L396) | [selu_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L192) | | -| oneflow.nn.functional.sigmoid | [oneflow.sigmoid](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L325) | [sigmoid_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L152) | | -| oneflow.nn.functional.silu | [oneflow.silu](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L224) | [silu_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L187) | | +| oneflow.nn.functional.pad | | [padding_idx](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_sparse.py#L140) | [pad_size_attribute_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_nn_functor.py#L89) | +| oneflow.nn.functional.prelu | | [prelu_4dim_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_prelu.py#L32) | [prelu_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_activation.py#L38) | +| oneflow.nn.functional.relu | [oneflow.Tensor.relu](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1135) | [relu_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L124) | [relu_inplace_runtime_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_activation.py#L29) | +| oneflow.nn.functional.relu6 | | [relu6_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L129) | | +| oneflow.nn.functional.selu | [oneflow.Tensor.selu](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1284) | [selu_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L199) | | +| oneflow.nn.functional.sigmoid | [oneflow.Tensor.sigmoid](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1291) | [sigmoid_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L154) | | +| oneflow.nn.functional.silu | [oneflow.Tensor.silu](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1305) | [silu_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L194) | | | oneflow.nn.functional.smooth_l1_loss | | | | -| oneflow.nn.functional.softmax | [oneflow.Tensor.softmax](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1141) | [softmax_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_activation.py#L395) | | -| oneflow.nn.functional.softplus | [oneflow.softplus](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L133) | [softplus](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_activation.py#L502) | | -| oneflow.nn.functional.softshrink | | [softshrink_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L207) | | -| oneflow.nn.functional.softsign | [oneflow.Tensor.softsign](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1155) | [softsign_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_activation.py#L685) | | +| oneflow.nn.functional.softmax | [oneflow.Tensor.softmax](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1333) | [softmax_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_activation.py#L415) | [softmax_index_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_activation.py#L109) | +| oneflow.nn.functional.softplus | [oneflow.Tensor.softplus](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1340) | [softplus_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L209) | | +| oneflow.nn.functional.softshrink | | [softshrink_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L214) | | +| oneflow.nn.functional.softsign | [oneflow.Tensor.softsign](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L1347) | [softsign_module_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_activation.py#L710) | | | oneflow.nn.functional.sparse_softmax_cross_entropy | | | | -| oneflow.nn.functional.tanh | [oneflow.tanh](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/activation.py#L150) | [tanh_module](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L132) | | +| oneflow.nn.functional.tanh | [oneflow.Tensor.arctanh](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/tensor.py#L663) | [tanh_module](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_consistent_activation.py#L134) | | | oneflow.nn.functional.triplet_margin_loss | | | | -| oneflow.nn.functional.upsample | | [upsample2d](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_upsample.py#L380) | | +| oneflow.nn.functional.upsample | | [upsample2d](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_upsample.py#L357) | | | oneflow.nn.init.CalcGain | | | | | oneflow.nn.init.calculate_gain | | | | | oneflow.nn.init.constant_ | | | | -| oneflow.nn.init.flow | [oneflow.decode_onerec](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/dataset.py#L20) | [flow_erf_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_erf.py#L33) | | +| oneflow.nn.init.flow | [oneflow.comm.send](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/comm.py#L20) | [flow_erf_with_random_data](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_erf.py#L33) | | | oneflow.nn.init.kaiming_normal_ | | | | | oneflow.nn.init.kaiming_uniform_ | | | | | oneflow.nn.init.normal_ | | | | | oneflow.nn.init.ones_ | | | | -| oneflow.nn.init.os | [oneflow.transpose](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L245) | [cos](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_math_ops.py#L88) | | +| oneflow.nn.init.os | [oneflow.transpose](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/framework/docstr/array_ops.py#L245) | [cos](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_math_ops.py#L88) | [cross_entropy_reduction_type_error](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/exceptions/test_nn_functor.py#L50) | | oneflow.nn.init.trunc_normal_ | | | | | oneflow.nn.init.uniform_ | | | | | oneflow.nn.init.xavier_normal_ | | | | | oneflow.nn.init.xavier_uniform_ | | | | | oneflow.nn.init.zeros_ | | | | -| oneflow.nn.init.adagrad | | [adagrad](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_optim_adagrad.py#L197) | | -| oneflow.nn.init.adam | | [adam](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_optim_adam.py#L241) | | -| oneflow.nn.init.adamw | | [adamw](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_optim_adamw.py#L244) | | +| oneflow.nn.init.adagrad | | [adagrad](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_optim_adagrad.py#L197) | | +| oneflow.nn.init.adam | | [adamw](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_optim_adamw.py#L244) | | +| oneflow.nn.init.adamw | | [adamw](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_optim_adamw.py#L244) | | | oneflow.nn.init.chained_scheduler | | | | | oneflow.nn.init.constant_lr | | | | | oneflow.nn.init.cosine_annealing_lr | | | | | oneflow.nn.init.cosine_annealing_warm_restarts | | | | | oneflow.nn.init.cosine_decay_lr | | | | | oneflow.nn.init.exponential_lr | | | | -| oneflow.nn.init.lamb | | [lambda_lr](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_lr_scheduler.py#L199) | | +| oneflow.nn.init.lamb | | [lambda_lr](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_lr_scheduler.py#L199) | | | oneflow.nn.init.lambda_lr | | | | | oneflow.nn.init.linear_lr | | | | | oneflow.nn.init.lr_scheduler | | | | | oneflow.nn.init.multistep_lr | | | | | oneflow.nn.init.polynomial_lr | | | | | oneflow.nn.init.reduce_lr_on_plateau | | | | -| oneflow.nn.init.rmsprop | | [rmsprop](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_optim_rmsprop.py#L228) | | +| oneflow.nn.init.rmsprop | | [rmsprop](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_optim_rmsprop.py#L228) | | | oneflow.nn.init.sequential_lr | | | | -| oneflow.nn.init.sgd | | [sgd](https://github.com/Oneflow-Inc/oneflow/blob/8e2da64b33b59cc907195de423dc7fa632c1fee6/python/oneflow/test/../../../python/oneflow/test/modules/test_optim_sgd.py#L194) | | +| oneflow.nn.init.sgd | | [sgd](https://github.com/Oneflow-Inc/oneflow/blob/64503e09ab90bd7e47e0682df217996daeec220d/python/oneflow/test/../../../python/oneflow/test/modules/test_optim_sgd.py#L194) | | | oneflow.nn.init.step_lr | | | | | oneflow.nn.init.warmup_lr | | | | ## Test Data Summary -- OneFlow Total API Number: ====================>448 -- Doc Test Ratio: ====================>35.71% = 160 / 448 -- Compatiable/Completeness Test Ratio: ====================>48.21% = 216 / 448 -- Exception Test Ratio: ====================>0.22% = 1 / 448 +- OneFlow Total API Number: ====================>446 +- Doc Test Ratio: ====================>36.32% = 162 / 446 +- Compatiable/Completeness Test Ratio: ====================>49.33% = 220 / 446 +- Exception Test Ratio: ====================>13.23% = 59 / 446 diff --git a/python/oneflow/test/gen_ops_process.py b/python/oneflow/test/gen_ops_process.py index a9c6def4628..6c6930f0bfc 100644 --- a/python/oneflow/test/gen_ops_process.py +++ b/python/oneflow/test/gen_ops_process.py @@ -152,8 +152,6 @@ "logical_and", "logical_not", "logical_or", - "logical_slice", - "logical_slice_assign", "logical_xor", "long", "lt", diff --git a/python/oneflow/test/modules/test_consistent_slice.py b/python/oneflow/test/modules/test_consistent_slice.py index d3dd5f7092a..55ea1752165 100644 --- a/python/oneflow/test/modules/test_consistent_slice.py +++ b/python/oneflow/test/modules/test_consistent_slice.py @@ -89,38 +89,21 @@ def _test_slice_ellipsis_type(test_case, placement, sbp): _check_forward_and_backward(test_case, input, of_out, torch_out) -def _test_logical_slice(test_case, placement, sbp): - input = random_tensor(2, 8, 8, requires_grad=True).oneflow - x_numpy = input.detach().cpu().numpy() - - x = input.to_global(placement=placement, sbp=sbp) - y = flow.logical_slice(x, slice_tup_list=[[0, 1, 1]]) - - # forward - test_case.assertTrue(np.array_equal(y.numpy(), x_numpy[0:1:1])) - - # backward - y.sum().backward() - input_grad_np = np.zeros((8, 8)) - input_grad_np[0:1:1, :] = 1 - test_case.assertTrue(np.array_equal(input.grad.numpy(), input_grad_np)) - - -def _test_logical_slice_with_bool(test_case, placement, sbp): +def _test_slice_with_bool(test_case, placement, sbp): x = random_tensor(2, 8, 8).oneflow > 0.5 x_numpy = x.detach().cpu().numpy() x = x.to_global(placement=placement, sbp=sbp) - y = flow.logical_slice(x, slice_tup_list=[[0, 1, 1]]) + y = flow.slice(x, slice_tup_list=[[0, 1, 1]]) test_case.assertTrue(np.array_equal(y.numpy(), x_numpy[0:1:1])) -def _test_logical_slice_with_grad(test_case, placement, sbp): +def _test_slice_with_grad(test_case, placement, sbp): x = random_tensor(2, 8, 16, requires_grad=True).oneflow x_numpy = x.detach().cpu().numpy() - class LogicalSliceWithGrad(flow.nn.Module): + class SliceWithGrad(flow.nn.Module): def __init__(self): super().__init__() self.input_grad = flow.nn.Parameter(flow.zeros(8, 16)) @@ -130,16 +113,16 @@ def forward(self, input): x = x.to_global(placement, sbp) return x[:, :8] - logical_slice_with_grad = LogicalSliceWithGrad().to_global( + slice_with_grad_m = SliceWithGrad().to_global( placement, [flow.sbp.broadcast,] * len(sbp) ) - of_sgd = flow.optim.SGD(logical_slice_with_grad.parameters(), lr=1.0, momentum=0.0) + of_sgd = flow.optim.SGD(slice_with_grad_m.parameters(), lr=1.0, momentum=0.0) - class LogicalSliceTrainGraph(flow.nn.Graph): + class SliceTrainGraph(flow.nn.Graph): def __init__(self): super().__init__() - self.module = logical_slice_with_grad + self.module = slice_with_grad_m self.add_optimizer(of_sgd) def build(self, x): @@ -148,7 +131,7 @@ def build(self, x): z.backward() return out - graph = LogicalSliceTrainGraph() + graph = SliceTrainGraph() input = x.to_global(placement=placement, sbp=sbp) y = graph(input) @@ -173,16 +156,8 @@ def test_slice(test_case): _test_slice_1dim(test_case, placement, sbp) _test_negative_index(test_case, placement, sbp) _test_slice_ellipsis_type(test_case, placement, sbp) - - -class TestLogicalSlice(flow.unittest.TestCase): - @globaltest - def test_logical_slice(test_case): - for placement in all_placement(): - for sbp in all_sbp(placement, max_dim=2): - _test_logical_slice(test_case, placement, sbp) - _test_logical_slice_with_bool(test_case, placement, sbp) - _test_logical_slice_with_grad(test_case, placement, sbp) + _test_slice_with_bool(test_case, placement, sbp) + _test_slice_with_grad(test_case, placement, sbp) if __name__ == "__main__": diff --git a/python/oneflow/test/modules/test_consistent_slice_assign.py b/python/oneflow/test/modules/test_consistent_slice_update.py similarity index 78% rename from python/oneflow/test/modules/test_consistent_slice_assign.py rename to python/oneflow/test/modules/test_consistent_slice_update.py index 410b199ac53..0c09f38f3eb 100644 --- a/python/oneflow/test/modules/test_consistent_slice_assign.py +++ b/python/oneflow/test/modules/test_consistent_slice_update.py @@ -22,7 +22,7 @@ from oneflow.test_utils.automated_test_util import * -def _test_logical_slice_assign(test_case, placement, sbp): +def _test_slice_update(test_case, placement, sbp): input = random_tensor(2, 8, 16, requires_grad=True).oneflow value = random_tensor(2, 8, 8, requires_grad=True).oneflow x = (input + 0).to_global( @@ -50,11 +50,11 @@ def _test_logical_slice_assign(test_case, placement, sbp): test_case.assertTrue(np.array_equal(value.grad.numpy(), value_grad_np)) -def _test_graph_logical_slice_assign(test_case, placement, sbp): +def _test_graph_slice_update(test_case, placement, sbp): ref = random_tensor(2, 8, 16, requires_grad=True).oneflow value = random_tensor(2, 8, 8, requires_grad=True).oneflow - class LogicalSliceAssignWithGrad(flow.nn.Module): + class SliceUpdateWithGrad(flow.nn.Module): def __init__(self): super().__init__() self.ref_grad = flow.nn.Parameter(flow.zeros(8, 16)) @@ -68,18 +68,16 @@ def forward(self, ref, value): x[:, :8] = y return x - logical_slice_assign_with_grad = LogicalSliceAssignWithGrad().to_global( + slice_update_with_grad_m = SliceUpdateWithGrad().to_global( placement, [flow.sbp.broadcast,] * len(sbp) ) - of_sgd = flow.optim.SGD( - logical_slice_assign_with_grad.parameters(), lr=1.0, momentum=0.0 - ) + of_sgd = flow.optim.SGD(slice_update_with_grad_m.parameters(), lr=1.0, momentum=0.0) - class LogicalSliceAssignTrainGraph(flow.nn.Graph): + class SliceUpdateTrainGraph(flow.nn.Graph): def __init__(self): super().__init__() - self.module = logical_slice_assign_with_grad + self.module = slice_update_with_grad_m self.add_optimizer(of_sgd) def build(self, x, y): @@ -88,7 +86,7 @@ def build(self, x, y): z.backward() return out - graph = LogicalSliceAssignTrainGraph() + graph = SliceUpdateTrainGraph() x = ref.to_global(placement=placement, sbp=sbp) y = value.to_global(placement=placement, sbp=sbp) @@ -117,15 +115,18 @@ def build(self, x, y): ) -class TestGlobalLogicalSliceAssign(flow.unittest.TestCase): +class TestGlobalSliceUpdate(flow.unittest.TestCase): @globaltest - def test_logical_slice_assign(test_case): + def test_slice_update(test_case): for placement in all_placement(): for sbp in all_sbp(placement, max_dim=2): + # TODO(wyg): It will be infer all broadcast sbp when 1n1d, + # slice_update will get error when doing inplace operator. + # Remove this judgement after refactor sbp infer method in Operator class. if placement.ranks.size == 1: continue - _test_logical_slice_assign(test_case, placement, sbp) - _test_graph_logical_slice_assign(test_case, placement, sbp) + _test_slice_update(test_case, placement, sbp) + _test_graph_slice_update(test_case, placement, sbp) if __name__ == "__main__": diff --git a/python/oneflow/test/modules/test_consistent_stateful_kernel_with_cache.py b/python/oneflow/test/modules/test_consistent_stateful_kernel_with_cache.py index 61aabee9e72..5f384d6470b 100644 --- a/python/oneflow/test/modules/test_consistent_stateful_kernel_with_cache.py +++ b/python/oneflow/test/modules/test_consistent_stateful_kernel_with_cache.py @@ -29,35 +29,18 @@ def _test_global_stateful_kernel_with_inpersistent_state(test_case, placement, s .to_global(flow.env.all_device_placement("cpu"), flow.sbp.broadcast) ) x = x.to_global(placement, sbp) - y = flow._C.logical_slice(x, [0, 0], [3, 1], [1, 1]) + y = x[0:3, 0:1] y_np = np.array([[0], [8], [16]]) - test_case.assertTrue( - np.array_equal( - y.to_global(flow.env.all_device_placement("cpu"), flow.sbp.broadcast) - .to_local() - .numpy(), - y_np, - ) - ) - x = x.to_global(sbp=flow.sbp.split(1)) - y = flow._C.logical_slice(x, [0, 0], [3, 1], [1, 1]) - test_case.assertTrue( - np.array_equal( - y.to_global(flow.env.all_device_placement("cpu"), flow.sbp.broadcast) - .to_local() - .numpy(), - y_np, - ) - ) + test_case.assertTrue(np.array_equal(y.numpy(), y_np,)) + x = x.to_global(flow.env.all_device_placement("cpu"), sbp=flow.sbp.split(1)) + y = x[0:3, 0:1] + test_case.assertTrue(np.array_equal(y.numpy(), y_np,)) class TestStatefulKernelWithInpersistentState(flow.unittest.TestCase): @globaltest def test_global_stateful_kernel_with_inpersistent_state(test_case): for placement in all_placement(): - # logical_slice only support 1d sbp - if len(placement.ranks.shape) != 1: - continue for sbp in all_sbp(placement, max_dim=2): _test_global_stateful_kernel_with_inpersistent_state( test_case, placement, sbp diff --git a/python/oneflow/test/modules/test_hsplit.py b/python/oneflow/test/modules/test_hsplit.py index 26c8d77a9f8..5dc413ebaf4 100644 --- a/python/oneflow/test/modules/test_hsplit.py +++ b/python/oneflow/test/modules/test_hsplit.py @@ -34,7 +34,7 @@ def test_flow_hsplit_vec(test_case): dim3=random(3, 6), ).to(device) z = torch.hsplit(x, (1, 2)) - return z[0] + return z @autotest(n=5) def test_flow_hsplit_vec_with_stride(test_case): @@ -50,7 +50,7 @@ def test_flow_hsplit_vec_with_stride(test_case): shuffle(perm) y = x.permute(perm) z = torch.hsplit(y, (1, 2)) - return z[0] + return z @flow.unittest.skip_unless_1n1d() @@ -63,7 +63,7 @@ def test_flow_hsplit_int(test_case): ).to(device) split = oneof(2, 4, 6) z = torch.hsplit(x, split) - return z[0] + return z if __name__ == "__main__": diff --git a/python/oneflow/test/modules/test_slice.py b/python/oneflow/test/modules/test_slice.py index 87f37b91ebe..a0cb1f8cc16 100644 --- a/python/oneflow/test/modules/test_slice.py +++ b/python/oneflow/test/modules/test_slice.py @@ -131,38 +131,6 @@ def _test_slice_backward(test_case, device): test_case.assertTrue(np.array_equal(x.grad.numpy(), np_grad)) -def _test_slice_update(test_case, device): - x = np.array([1, 1, 1, 1, 1]).astype(np.float32) - input = flow.tensor(x, requires_grad=True) - input.retain_grad() - update = flow.tensor(np.array([2, 3, 4]).astype(np.float32), requires_grad=True) - output = np.array([1.0, 2.0, 3.0, 4.0, 1.0]) - # Get the inplaced tensor grad by another tensor - t = input + 0 - flow._C.slice_update(t, update, [1,], [4,], [1,], inplace=True) - z = t.sum() - z.backward() - test_case.assertTrue(np.array_equal(t.numpy(), output)) - np_grad = np.zeros(x.shape) - np_grad[0] = 1 - np_grad[4] = 1 - test_case.assertTrue(np.array_equal(input.grad.numpy(), np_grad)) - test_case.assertTrue(np.array_equal(update.grad.numpy(), np.ones(update.shape))) - - -def _test_slice_update_with_stride(test_case, device): - arr = np.arange(24).reshape(2, 2, 2, 3).astype(np.float32) - np_in = arr - np_out = np_in.transpose(1, 0, 2, 3) - np_out[0:1, 1:2, :, 1:2] = 3.1415 - - input = flow.tensor(arr, device=flow.device(device)) - output = input.permute(1, 0, 2, 3) - output[0:1, 1:2, :, 1:2] = 3.1415 - - test_case.assertTrue(np.array_equal(output.numpy(), np_out)) - - @flow.unittest.skip_unless_1n1d() class TestSlice(flow.unittest.TestCase): def test_slice(test_case): @@ -185,88 +153,22 @@ def test_slice(test_case): @flow.unittest.skip_unless_1n1d() class TestSliceUpdate(flow.unittest.TestCase): - def test_slice(test_case): - arg_dict = OrderedDict() - arg_dict["test_fun"] = [ - _test_slice_update, - # # TODO:(zhaoluyang) test when slice_update support stride - # _test_slice_update_with_stride - ] - arg_dict["device"] = ["cpu", "cuda"] - for arg in GenArgList(arg_dict): - arg[0](test_case, *arg[1:]) - - def test_slice_update_graph(test_case): - x = np.array([1, 1, 1, 1, 1]).astype(np.float32) - input = flow.tensor(x, requires_grad=True) - update = flow.tensor(np.array([2, 3, 4]).astype(np.float32), requires_grad=True) - output = np.array([1.0, 2.0, 3.0, 4.0, 1.0]) - - class TestModule(flow.nn.Module): - def __init__(self): - super().__init__() - self.weight = flow.nn.Parameter(flow.Tensor(x)) - - def forward(self, x, update): - flow._C.slice_update(x, update, [1,], [4,], [1,], inplace=True) - y = x + self.weight - return x, y - - test_m = TestModule() - of_sgd = flow.optim.SGD(test_m.parameters(), lr=0.001, momentum=0.9) - - class TestSliceUpdateGraph(flow.nn.Graph): - def __init__(self): - super().__init__() - self.m = test_m - self.add_optimizer(of_sgd) - - def build(self, x, update): - x, y = self.m(x, update) - z = y.sum() - z.backward() - return x - - slice_update_g = TestSliceUpdateGraph() - - y = slice_update_g(input, update) - test_case.assertTrue(np.array_equal(y.numpy(), output)) - # TODO(): check grad of slice_update in graph. - - -@flow.unittest.skip_unless_1n1d() -class TestLogicalSliceAssign(flow.unittest.TestCase): - def test_logical_slice_assign(test_case): + def test_slice_update(test_case): x = np.array([1, 1, 1, 1, 1]).astype(np.float32) input = flow.tensor(x) update = flow.tensor(np.array([2, 3, 4]).astype(np.float32)) output = np.array([1.0, 2.0, 3.0, 4.0, 1.0]) - flow.logical_slice_assign(input, update, slice_tup_list=[[1, 4, 1]]) + flow.slice_update(input, update, slice_tup_list=[[1, 4, 1]]) test_case.assertTrue(np.array_equal(input.numpy(), output)) - def test_logical_slice_assign_graph(test_case): - x = np.array([1, 1, 1, 1, 1]).astype(np.float32) - input = flow.tensor(x) - update = flow.tensor(np.array([2, 3, 4]).astype(np.float32)) - output = np.array([1.0, 2.0, 3.0, 4.0, 1.0]) - - @flow.nn.Graph.to_graph - def test_func(input): - flow.logical_slice_assign(input, update, slice_tup_list=[[1, 4, 1]]) - return input - - # NOTE(strint): input outside the graph has not been change yet currently. - out = test_func(input) - test_case.assertTrue(np.array_equal(out.numpy(), output)) - - def test_logical_slice_assign_negative_index(test_case): + def test_slice_update_negative_index(test_case): np_arr = np.zeros(shape=(2, 3, 4)) input = flow.tensor(np_arr, dtype=flow.float32) np_arr[-1] = 1 input[-1] = 1 test_case.assertTrue(np.array_equal(input.numpy(), np_arr)) - def test_logical_slice_assign_negative_index_graph(test_case): + def test_slice_update_negative_index_graph(test_case): np_arr = np.zeros(shape=(2, 3, 4)) input = flow.tensor(np_arr, dtype=flow.float32) np_arr[-1] = 1 @@ -279,14 +181,14 @@ def test_func(): out = test_func() test_case.assertTrue(np.array_equal(out.numpy(), np_arr)) - def test_logical_slice_assign_ellipsis_type(test_case): + def test_slice_update_ellipsis_type(test_case): np_arr = np.zeros(shape=(2, 3, 4, 5, 6)) input = flow.tensor(np_arr, dtype=flow.float32) np_arr[0, ::1, ..., 2:3] = 1 input[0, ::1, ..., 2:3] = 1 test_case.assertTrue(np.array_equal(input.numpy(), np_arr)) - def test_logical_slice_assign_ellipsis_type_graph(test_case): + def test_slice_update_ellipsis_type_graph(test_case): np_arr = np.zeros(shape=(2, 3, 4, 5, 6)) input = flow.tensor(np_arr, dtype=flow.float32) np_arr[0, ::1, ..., 2:3] = 1 @@ -299,6 +201,63 @@ def test_func(): out = test_func() test_case.assertTrue(np.array_equal(out.numpy(), np_arr)) + def test_slice_update_grad_graph(test_case): + x = np.array([1, 1, 1, 1, 1]).astype(np.float32) + input = flow.tensor(x, requires_grad=True) + update = flow.tensor(np.array([2, 3, 4]).astype(np.float32), requires_grad=True) + output = np.array([1.0, 2.0, 3.0, 4.0, 1.0]) + + class TestModule(flow.nn.Module): + def __init__(self): + super().__init__() + self.ref_grad = flow.nn.Parameter(flow.zeros(5)) + self.value_grad = flow.nn.Parameter(flow.zeros(3)) + + def forward(self, ref, value): + x = ref + self.ref_grad + y = value + self.value_grad + return flow._C.slice_update(x, y, [1,], [4,], [1,]) + + test_m = TestModule() + of_sgd = flow.optim.SGD(test_m.parameters(), lr=1.0, momentum=0.0) + + class TestSliceUpdateGraph(flow.nn.Graph): + def __init__(self): + super().__init__() + self.m = test_m + self.add_optimizer(of_sgd) + + def build(self, ref, update): + x = self.m(ref, update) + x.sum().backward() + return x + + slice_update_g = TestSliceUpdateGraph() + + y = slice_update_g(input, update) + + # forward + test_case.assertTrue(np.array_equal(y.numpy(), output)) + # ref grad + ref_grad = np.array([1.0, 0.0, 0.0, 0.0, 1.0]).astype(np.float32) + test_case.assertTrue(np.array_equal(-test_m.ref_grad, ref_grad)) + # value grad + value_grad = np.array([1.0, 1.0, 1.0]).astype(np.float32) + test_case.assertTrue(np.array_equal(-test_m.value_grad, value_grad)) + + @unittest.skip("TODO:(zhaoluyang) test when slice_update support stride") + def test_slice_update_with_stride(test_case, device): + arr = np.arange(24).reshape(2, 2, 2, 3).astype(np.float32) + np_in = arr + np_out = np_in.transpose(1, 0, 2, 3) + np_out[0:1, 1:2, :, 1:2] = 3.1415 + + input = flow.tensor(arr, device=flow.device(device)) + output = input.permute(1, 0, 2, 3) + output[0:1, 1:2, :, 1:2] = 3.1415 + + test_case.assertTrue(np.array_equal(output.numpy(), np_out)) + if __name__ == "__main__": unittest.main() diff --git a/python/oneflow/test/modules/test_stateful_kernel_with_cache.py b/python/oneflow/test/modules/test_stateful_kernel_with_cache.py index 0c1c783d5bf..76893f4680b 100644 --- a/python/oneflow/test/modules/test_stateful_kernel_with_cache.py +++ b/python/oneflow/test/modules/test_stateful_kernel_with_cache.py @@ -28,13 +28,13 @@ class TestStatefulKernelWithInpersistentState(flow.unittest.TestCase): def test_stateful_kernel_with_inpersistent_state(test_case): x = flow.arange(4).reshape(2, 2) x = x.to_global(flow.env.all_device_placement("cuda"), flow.sbp.split(0)) - y = flow._C.logical_slice(x, [0, 0], [3, 1], [1, 1]) + y = x[0:3, 0:1] y_np = np.array([[0], [2], [0]]) test_case.assertTrue( np.array_equal(y.to_global(sbp=flow.sbp.broadcast).to_local().numpy(), y_np) ) x = x.to_global(sbp=flow.sbp.split(1)) - y = flow._C.logical_slice(x, [0, 0], [3, 1], [1, 1]) + y = x[0:3, 0:1] test_case.assertTrue( np.array_equal(y.to_global(sbp=flow.sbp.broadcast).to_local().numpy(), y_np) ) diff --git a/python/oneflow/test/tensor/test_tensor_part_1.py b/python/oneflow/test/tensor/test_tensor_part_1.py index 55da4a4a373..a37c442775a 100644 --- a/python/oneflow/test/tensor/test_tensor_part_1.py +++ b/python/oneflow/test/tensor/test_tensor_part_1.py @@ -940,23 +940,6 @@ def test_tensor_slice(test_case): np.allclose(input[0, :, 0:2].numpy(), x[0, :, 0:2], 1e-05, 1e-05) ) - @flow.unittest.skip_unless_1n1d() - def test_tensor_logical_slice_assign(test_case): - x = np.random.randn(2, 3, 4, 5).astype(np.float32) - input = flow.tensor(x) - input[:, 0] = 3.1415926 - x[:, 0] = 3.1415926 - test_case.assertTrue(np.allclose(input.numpy(), x, 1e-05, 1e-05)) - input[:, 1:2] = 1 - x[:, 1:2] = 1 - test_case.assertTrue(np.allclose(input.numpy(), x, 1e-05, 1e-05)) - input[:] = 1.234 - x[:] = 1.234 - test_case.assertTrue(np.allclose(input.numpy(), x, 1e-05, 1e-05)) - input[0] = 0 - x[0] = 0 - test_case.assertTrue(np.allclose(input.numpy(), x, 1e-05, 1e-05)) - @flow.unittest.skip_unless_1n1d() def test_zeros_(test_case): shape = (2, 3)