Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
c086d91a
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c086d91a
编写于
5月 28, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
5月 28, 2020
浏览文件
操作
浏览文件
下载
差异文件
!1505 Add some checks in ConstToAttr[StridedSliceGrad] pass
Merge pull request !1505 from huanghui/stride-slice
上级
ab94e92c
1d65ae59
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
294 addition
and
56 deletion
+294
-56
mindspore/ccsrc/pre_activate/common/common_backend_optimization.cc
.../ccsrc/pre_activate/common/common_backend_optimization.cc
+2
-0
mindspore/ccsrc/pre_activate/common/helper.cc
mindspore/ccsrc/pre_activate/common/helper.cc
+1
-1
mindspore/ccsrc/pre_activate/pass/const_input_to_attr_registry.cc
...e/ccsrc/pre_activate/pass/const_input_to_attr_registry.cc
+0
-1
mindspore/ccsrc/pre_activate/pass/const_to_attr_strided_slice_grad.cc
...src/pre_activate/pass/const_to_attr_strided_slice_grad.cc
+132
-0
mindspore/ccsrc/pre_activate/pass/const_to_attr_strided_slice_grad.h
...csrc/pre_activate/pass/const_to_attr_strided_slice_grad.h
+34
-0
mindspore/ccsrc/utils/utils.h
mindspore/ccsrc/utils/utils.h
+2
-0
tests/ut/cpp/pre_activate/pass/const_to_attr_strided_slice_grad_test.cc
...re_activate/pass/const_to_attr_strided_slice_grad_test.cc
+77
-0
tests/ut/cpp/pre_activate/pass/convert_const_input_to_attr_test.cc
...cpp/pre_activate/pass/convert_const_input_to_attr_test.cc
+0
-39
tests/ut/cpp/python_input/gtest_input/pre_activate/const_to_attr_strided_slice_grad.py
...st_input/pre_activate/const_to_attr_strided_slice_grad.py
+46
-0
tests/ut/cpp/python_input/gtest_input/pre_activate/convert_const_input_test.py
...nput/gtest_input/pre_activate/convert_const_input_test.py
+0
-15
未找到文件。
mindspore/ccsrc/pre_activate/common/common_backend_optimization.cc
浏览文件 @
c086d91a
...
...
@@ -21,6 +21,7 @@
#include "pre_activate/pass/convert_tuple_output_to_maketuple.h"
#include "pre_activate/pass/convert_const_input_to_tensor_input.h"
#include "pre_activate/pass/convert_tuple_input_to_dynamic_input.h"
#include "pre_activate/pass/const_to_attr_strided_slice_grad.h"
#include "utils/context/ms_context.h"
#include "debug/anf_ir_dump.h"
...
...
@@ -42,6 +43,7 @@ void BackendCommonOptimization(const std::shared_ptr<session::KernelGraph> &kern
auto
optimizer
=
std
::
make_shared
<
GraphOptimizer
>
();
auto
common_pm
=
std
::
make_shared
<
PassManager
>
(
"common_pm"
);
common_pm
->
AddPass
(
std
::
make_shared
<
ConvertConstInputToAttr
>
());
common_pm
->
AddPass
(
std
::
make_shared
<
ConstToAttrStridedSliceGradPass
>
());
common_pm
->
AddPass
(
std
::
make_shared
<
ConvertConstInputToTensorInput
>
());
common_pm
->
AddPass
(
std
::
make_shared
<
ConvertTupleInputToDynamicInput
>
());
common_pm
->
AddPass
(
std
::
make_shared
<
ConvertTupleOutputToMaketuple
>
());
...
...
mindspore/ccsrc/pre_activate/common/helper.cc
浏览文件 @
c086d91a
...
...
@@ -687,7 +687,7 @@ bool IsSameNode(const EquivPtr &equiv1, const EquivPtr &equiv2, const VarPtr &va
MS_EXCEPTION_IF_NULL
(
equiv1_node
);
auto
equiv2_node
=
GetAnfNodeByVar
(
equiv2
,
var_node
);
MS_EXCEPTION_IF_NULL
(
equiv2_node
);
return
equiv1_node
==
equiv2_node
;
return
*
equiv1_node
==
*
equiv2_node
;
}
AnfNodePtr
GetAnfNodeByVar
(
const
EquivPtr
&
equiv
,
const
VarPtr
&
var_node
)
{
...
...
mindspore/ccsrc/pre_activate/pass/const_input_to_attr_registry.cc
浏览文件 @
c086d91a
...
...
@@ -52,7 +52,6 @@ ConstInputToAttrInfoRegistry::ConstInputToAttrInfoRegistry() {
Register
(
kScatterNdOpName
,
{
2
});
Register
(
kStridedSliceAssignOpName
,
{
1
,
2
,
3
});
Register
(
kStridedSliceOpName
,
{
1
,
2
,
3
});
Register
(
kStridedSliceGradOpName
,
{
1
,
2
,
3
,
4
});
Register
(
kFlattenGradOpName
,
{
1
});
Register
(
kExpandDimsOpName
,
{
1
});
Register
(
kSplitOpName
,
{
0
});
...
...
mindspore/ccsrc/pre_activate/pass/const_to_attr_strided_slice_grad.cc
0 → 100644
浏览文件 @
c086d91a
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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 "pre_activate/pass/const_to_attr_strided_slice_grad.h"
#include <memory>
#include <vector>
#include "session/anf_runtime_algorithm.h"
#include "ir/primitive.h"
#include "utils/utils.h"
#include "pipeline/static_analysis/abstract_value.h"
#include "pre_activate/common/helper.h"
namespace
mindspore
{
namespace
opt
{
namespace
{
const
size_t
strides_index
=
5
;
bool
GetStridesValues
(
const
CNodePtr
&
strided_slice_grad
,
ValuePtrList
*
strides_values
)
{
MS_EXCEPTION_IF_NULL
(
strided_slice_grad
);
if
(
strided_slice_grad
->
size
()
<
6
)
{
MS_LOG
(
DEBUG
)
<<
"Op strided_slice_grad's inputs size less than 6, graph not changed"
;
return
false
;
}
auto
strides_input
=
strided_slice_grad
->
input
(
strides_index
);
MS_EXCEPTION_IF_NULL
(
strides_input
);
auto
strides_value_node
=
strides_input
->
cast
<
ValueNodePtr
>
();
if
(
strides_value_node
==
nullptr
)
{
MS_LOG
(
DEBUG
)
<<
"strides is not a value node."
;
return
false
;
}
auto
value
=
strides_value_node
->
value
();
if
(
value
==
nullptr
)
{
MS_LOG
(
DEBUG
)
<<
"strides has no value."
;
return
false
;
}
auto
value_tuple
=
value
->
cast
<
ValueTuplePtr
>
();
if
(
value_tuple
==
nullptr
)
{
MS_LOG
(
DEBUG
)
<<
"strides is not a value tuple."
;
return
false
;
}
*
strides_values
=
value_tuple
->
value
();
return
true
;
}
bool
CheckValues
(
const
ValuePtrList
&
strides_values
)
{
if
(
strides_values
.
empty
())
{
MS_LOG
(
DEBUG
)
<<
"strides_values is empty"
;
return
false
;
}
for
(
auto
&
value
:
strides_values
)
{
MS_EXCEPTION_IF_NULL
(
value
);
if
(
value
->
isa
<
Scalar
>
())
{
auto
scalar
=
value
->
cast
<
ScalarPtr
>
();
MS_EXCEPTION_IF_NULL
(
scalar
);
if
(
!
scalar
->
isa
<
Int32Imm
>
())
{
MS_LOG
(
DEBUG
)
<<
"strides value is not a Integer"
;
return
false
;
}
if
(
GetValue
<
int
>
(
scalar
)
!=
1
)
{
MS_LOG
(
DEBUG
)
<<
"StridedSliceGrad has no 1 value"
;
return
false
;
}
}
else
{
MS_LOG
(
DEBUG
)
<<
"The value "
<<
value
<<
"of tuple is not a scalar"
;
return
false
;
}
}
return
true
;
}
bool
CheckAttrs
(
const
CNodePtr
&
strided_slice_grad
)
{
MS_EXCEPTION_IF_NULL
(
strided_slice_grad
);
if
(
!
AnfAlgo
::
HasNodeAttr
(
kAttrNewAxisMask
,
strided_slice_grad
)
||
!
AnfAlgo
::
HasNodeAttr
(
kAttrShrinkAxisMask
,
strided_slice_grad
))
{
MS_LOG
(
INFO
)
<<
"new_axis_mask or shrink_axis_mask not exist in cnode["
+
strided_slice_grad
->
DebugString
()
+
"]"
;
return
false
;
}
auto
new_axis_mask
=
AnfAlgo
::
GetNodeAttr
<
int
>
(
strided_slice_grad
,
kAttrNewAxisMask
);
auto
shrink_axis_mask
=
AnfAlgo
::
GetNodeAttr
<
int
>
(
strided_slice_grad
,
kAttrShrinkAxisMask
);
if
(
new_axis_mask
!=
0
||
shrink_axis_mask
!=
0
)
{
MS_LOG
(
INFO
)
<<
"new_axis_mask or shrink_axis_mask not equal 0"
;
return
false
;
}
return
true
;
}
}
// namespace
const
BaseRef
ConstToAttrStridedSliceGradPass
::
DefinePattern
()
const
{
VarPtr
Xs
=
std
::
make_shared
<
SeqVar
>
();
auto
strided_slice_grad_prim
=
std
::
make_shared
<
Primitive
>
(
kStridedSliceGradOpName
);
return
VectorRef
({
strided_slice_grad_prim
,
Xs
});
}
const
AnfNodePtr
ConstToAttrStridedSliceGradPass
::
Process
(
const
FuncGraphPtr
&
graph
,
const
AnfNodePtr
&
node
,
const
EquivPtr
&
)
const
{
MS_EXCEPTION_IF_NULL
(
graph
);
MS_EXCEPTION_IF_NULL
(
node
);
auto
strided_slice_grad
=
node
->
cast
<
CNodePtr
>
();
MS_EXCEPTION_IF_NULL
(
strided_slice_grad
);
if
(
!
CheckAttrs
(
strided_slice_grad
))
{
MS_LOG
(
INFO
)
<<
"Check strided_slice_grad's attrs failed, graph not changed"
;
return
nullptr
;
}
ValuePtrList
strides_values
;
if
(
!
GetStridesValues
(
strided_slice_grad
,
&
strides_values
))
{
return
nullptr
;
}
if
(
!
CheckValues
(
strides_values
))
{
MS_LOG
(
INFO
)
<<
"Check strides' values failed, graph not changed"
;
return
nullptr
;
}
ConstInputToAttr
(
strided_slice_grad
,
{
1
,
2
,
3
,
4
});
return
nullptr
;
}
}
// namespace opt
}
// namespace mindspore
mindspore/ccsrc/pre_activate/pass/const_to_attr_strided_slice_grad.h
0 → 100644
浏览文件 @
c086d91a
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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.
*/
#ifndef MINDSPORE_CCSRC_PRE_ACTIVATE_PASS_CONST_TO_ATTR_STRIDED_SLICE_GRAD_H_
#define MINDSPORE_CCSRC_PRE_ACTIVATE_PASS_CONST_TO_ATTR_STRIDED_SLICE_GRAD_H_
#include <memory>
#include "pre_activate/common/optimizer.h"
namespace
mindspore
{
namespace
opt
{
class
ConstToAttrStridedSliceGradPass
:
public
PatternProcessPass
{
public:
explicit
ConstToAttrStridedSliceGradPass
(
bool
multigraph
=
true
)
:
PatternProcessPass
(
"const_to_attr_strided_slice_grad_"
,
multigraph
)
{}
~
ConstToAttrStridedSliceGradPass
()
override
=
default
;
const
BaseRef
DefinePattern
()
const
override
;
const
AnfNodePtr
Process
(
const
FuncGraphPtr
&
,
const
AnfNodePtr
&
,
const
EquivPtr
&
)
const
override
;
};
}
// namespace opt
}
// namespace mindspore
#endif // MINDSPORE_CCSRC_PRE_ACTIVATE_PASS_CONST_TO_ATTR_STRIDED_SLICE_GRAD_H_
mindspore/ccsrc/utils/utils.h
浏览文件 @
c086d91a
...
...
@@ -193,6 +193,8 @@ constexpr auto kAttrIsTraining = "is_training";
constexpr
auto
kAttrFusionId
=
"fusion_id"
;
constexpr
auto
kAttrLabelIndex
=
"label_index"
;
constexpr
auto
kAttrLabelSwitchList
=
"label_switch_list"
;
constexpr
auto
kAttrNewAxisMask
=
"new_axis_mask"
;
constexpr
auto
kAttrShrinkAxisMask
=
"shrink_axis_mask"
;
// attr value
constexpr
auto
kValueTargetSwitch
=
"target_switch"
;
...
...
tests/ut/cpp/pre_activate/pass/const_to_attr_strided_slice_grad_test.cc
0 → 100644
浏览文件 @
c086d91a
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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 "common/backend_common_test.h"
#include "operator/ops.h"
#include "debug/anf_ir_dump.h"
#include "common/py_func_graph_fetcher.h"
#include "session/anf_runtime_algorithm.h"
#include "pre_activate/common/optimizer.h"
#include "pre_activate/common/pass_manager.h"
#include "pre_activate/pass/const_to_attr_strided_slice_grad.h"
#include "utils/utils.h"
#include "common/utils.h"
namespace
mindspore
{
namespace
opt
{
class
TestHWConstToAttrStridedSliceGrad
:
public
BackendCommon
{
public:
TestHWConstToAttrStridedSliceGrad
()
:
getPyFun_
(
"gtest_input.pre_activate.const_to_attr_strided_slice_grad"
,
true
)
{}
~
TestHWConstToAttrStridedSliceGrad
()
override
=
default
;
public:
UT
::
PyFuncGraphFetcher
getPyFun_
;
};
TEST_F
(
TestHWConstToAttrStridedSliceGrad
,
test_strided_slice_grad
)
{
FuncGraphPtr
g
=
getPyFun_
.
CallAndParseRet
(
"test_const_to_attr_strided_slice_grad"
,
"before"
);
ASSERT_TRUE
(
g
!=
nullptr
);
FuncGraphPtr
g_after
=
getPyFun_
.
CallAndParseRet
(
"test_const_to_attr_strided_slice_grad"
,
"after"
);
ASSERT_TRUE
(
g_after
!=
nullptr
);
auto
ret
=
g
->
get_return
();
ASSERT_TRUE
(
ret
!=
nullptr
);
EXPECT_NE
(
ret
->
input
(
1
),
nullptr
);
EXPECT_NE
(
ret
->
input
(
1
)
->
cast
<
CNodePtr
>
(),
nullptr
);
auto
cnode
=
ret
->
input
(
1
)
->
cast
<
CNodePtr
>
();
EXPECT_FALSE
(
AnfAlgo
::
HasNodeAttr
(
"shapex"
,
cnode
));
EXPECT_FALSE
(
AnfAlgo
::
HasNodeAttr
(
"begin"
,
cnode
));
EXPECT_FALSE
(
AnfAlgo
::
HasNodeAttr
(
"end"
,
cnode
));
EXPECT_FALSE
(
AnfAlgo
::
HasNodeAttr
(
"strides"
,
cnode
));
EXPECT_FALSE
(
CheckEqualGraph
(
g
,
g_after
));
std
::
vector
<
int
>
shp_x
{
16
,
1
,
1024
};
auto
x_abstract
=
std
::
make_shared
<
abstract
::
AbstractTensor
>
(
kFloat32
,
shp_x
);
AbstractBasePtrList
args_spec_list
{
x_abstract
};
auto
kg
=
GetKernelGraph
(
g
,
args_spec_list
);
ASSERT_TRUE
(
kg
!=
nullptr
);
ret
=
kg
->
get_return
();
ASSERT_TRUE
(
ret
!=
nullptr
);
EXPECT_NE
(
ret
->
input
(
1
),
nullptr
);
EXPECT_NE
(
ret
->
input
(
1
)
->
cast
<
CNodePtr
>
(),
nullptr
);
auto
make_tuple
=
ret
->
input
(
1
)
->
cast
<
CNodePtr
>
();
ASSERT_TRUE
(
make_tuple
!=
nullptr
);
EXPECT_NE
(
make_tuple
->
input
(
1
),
nullptr
);
EXPECT_NE
(
make_tuple
->
input
(
1
)
->
cast
<
CNodePtr
>
(),
nullptr
);
cnode
=
make_tuple
->
input
(
1
)
->
cast
<
CNodePtr
>
();
EXPECT_TRUE
(
AnfAlgo
::
HasNodeAttr
(
"shapex"
,
cnode
));
EXPECT_TRUE
(
AnfAlgo
::
HasNodeAttr
(
"begin"
,
cnode
));
EXPECT_TRUE
(
AnfAlgo
::
HasNodeAttr
(
"end"
,
cnode
));
EXPECT_TRUE
(
AnfAlgo
::
HasNodeAttr
(
"strides"
,
cnode
));
EXPECT_TRUE
(
CheckEqualGraph
(
kg
,
g_after
));
}
}
// namespace opt
}
// namespace mindspore
tests/ut/cpp/pre_activate/pass/convert_const_input_to_attr_test.cc
浏览文件 @
c086d91a
...
...
@@ -109,44 +109,5 @@ TEST_F(TestHWConstInputToAttr, test_onehot) {
EXPECT_TRUE
(
AnfAlgo
::
HasNodeAttr
(
"depth"
,
cnode
));
EXPECT_TRUE
(
CheckEqualGraph
(
func_graph
,
g_after
));
}
TEST_F
(
TestHWConstInputToAttr
,
test_strided_slice_grad
)
{
FuncGraphPtr
g
=
getPyFun_
.
CallAndParseRet
(
"test_convert_strided_slice_grad_input_to_attr"
,
"before"
);
ASSERT_TRUE
(
g
!=
nullptr
);
FuncGraphPtr
g_after
=
getPyFun_
.
CallAndParseRet
(
"test_convert_strided_slice_grad_input_to_attr"
,
"after"
);
ASSERT_TRUE
(
g_after
!=
nullptr
);
auto
ret
=
g
->
get_return
();
ASSERT_TRUE
(
ret
!=
nullptr
);
EXPECT_NE
(
ret
->
input
(
1
),
nullptr
);
EXPECT_NE
(
ret
->
input
(
1
)
->
cast
<
CNodePtr
>
(),
nullptr
);
auto
cnode
=
ret
->
input
(
1
)
->
cast
<
CNodePtr
>
();
EXPECT_FALSE
(
AnfAlgo
::
HasNodeAttr
(
"shapex"
,
cnode
));
EXPECT_FALSE
(
AnfAlgo
::
HasNodeAttr
(
"begin"
,
cnode
));
EXPECT_FALSE
(
AnfAlgo
::
HasNodeAttr
(
"end"
,
cnode
));
EXPECT_FALSE
(
AnfAlgo
::
HasNodeAttr
(
"strides"
,
cnode
));
EXPECT_FALSE
(
CheckEqualGraph
(
g
,
g_after
));
std
::
vector
<
int
>
shp_x
{
16
,
1
,
1024
};
auto
x_abstract
=
std
::
make_shared
<
abstract
::
AbstractTensor
>
(
kFloat32
,
shp_x
);
AbstractBasePtrList
args_spec_list
{
x_abstract
};
auto
func_graph
=
GetKernelGraph
(
g
,
args_spec_list
);
ASSERT_TRUE
(
func_graph
!=
nullptr
);
ret
=
func_graph
->
get_return
();
ASSERT_TRUE
(
ret
!=
nullptr
);
EXPECT_NE
(
ret
->
input
(
1
),
nullptr
);
EXPECT_NE
(
ret
->
input
(
1
)
->
cast
<
CNodePtr
>
(),
nullptr
);
auto
make_tuple
=
ret
->
input
(
1
)
->
cast
<
CNodePtr
>
();
ASSERT_TRUE
(
make_tuple
!=
nullptr
);
EXPECT_NE
(
make_tuple
->
input
(
1
),
nullptr
);
EXPECT_NE
(
make_tuple
->
input
(
1
)
->
cast
<
CNodePtr
>
(),
nullptr
);
cnode
=
make_tuple
->
input
(
1
)
->
cast
<
CNodePtr
>
();
EXPECT_TRUE
(
AnfAlgo
::
HasNodeAttr
(
"shapex"
,
cnode
));
EXPECT_TRUE
(
AnfAlgo
::
HasNodeAttr
(
"begin"
,
cnode
));
EXPECT_TRUE
(
AnfAlgo
::
HasNodeAttr
(
"end"
,
cnode
));
EXPECT_TRUE
(
AnfAlgo
::
HasNodeAttr
(
"strides"
,
cnode
));
EXPECT_TRUE
(
CheckEqualGraph
(
func_graph
,
g_after
));
}
}
// namespace opt
}
// namespace mindspore
tests/ut/cpp/python_input/gtest_input/pre_activate/const_to_attr_strided_slice_grad.py
0 → 100644
浏览文件 @
c086d91a
# Copyright 2020 Huawei Technologies Co., Ltd
#
# 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.
# ============================================================================
from
mindspore.ops
import
Primitive
from
mindspore.ops.operations
import
_grad_ops
as
G
stridedslicegrad
=
G
.
StridedSliceGrad
()
backend_stridedslicegrad
=
Primitive
(
'StridedSliceGrad'
)
make_tuple
=
Primitive
(
'make_tuple'
)
class
FnDict
:
def
__init__
(
self
):
self
.
fnDict
=
{}
def
__call__
(
self
,
fn
):
self
.
fnDict
[
fn
.
__name__
]
=
fn
def
__getitem__
(
self
,
name
):
return
self
.
fnDict
[
name
]
def
test_const_to_attr_strided_slice_grad
(
tag
):
fns
=
FnDict
()
@
fns
def
before
(
x
):
return
stridedslicegrad
(
x
,
(
16
,
128
,
1024
),
(
0
,
0
,
0
),
(
16
,
1
,
1024
),
(
1
,
1
,
1
))
@
fns
def
after
(
x
):
res
=
backend_stridedslicegrad
(
x
)
return
make_tuple
(
res
)
return
fns
[
tag
]
tests/ut/cpp/python_input/gtest_input/pre_activate/convert_const_input_test.py
浏览文件 @
c086d91a
...
...
@@ -110,21 +110,6 @@ def test_convert_onehot_input_to_attr(tag):
return
fns
[
tag
]
def
test_convert_strided_slice_grad_input_to_attr
(
tag
):
fns
=
FnDict
()
@
fns
def
before
(
x
):
return
stridedslicegrad
(
x
,
(
16
,
128
,
1024
),
(
0
,
0
,
0
),
(
16
,
1
,
1024
),
(
1
,
1
,
1
))
@
fns
def
after
(
x
):
res
=
backend_stridedslicegrad
(
x
)
return
make_tuple
(
res
)
return
fns
[
tag
]
def
test_convert_onehot_input_to_tensor1
(
tag
):
fns
=
FnDict
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录