Change make tuple in core.ops
This commit is contained in:
parent
b575068cb3
commit
680324f225
|
@ -176,7 +176,7 @@ class PrimLib:
|
||||||
'ReduceSum': Prim(REDUCE),
|
'ReduceSum': Prim(REDUCE),
|
||||||
'ReduceMax': Prim(REDUCE),
|
'ReduceMax': Prim(REDUCE),
|
||||||
'ReduceMin': Prim(REDUCE),
|
'ReduceMin': Prim(REDUCE),
|
||||||
'make_tuple': Prim(CONTROL),
|
'MakeTuple': Prim(CONTROL),
|
||||||
'ControlDepend': Prim(CONTROL),
|
'ControlDepend': Prim(CONTROL),
|
||||||
'Assign': Prim(ELEMWISE),
|
'Assign': Prim(ELEMWISE),
|
||||||
'Tanh': Prim(ELEMWISE),
|
'Tanh': Prim(ELEMWISE),
|
||||||
|
|
|
@ -121,7 +121,7 @@ convert_object_map = {
|
||||||
T.next: M.ms_next,
|
T.next: M.ms_next,
|
||||||
T.hasnext: M.hasnext,
|
T.hasnext: M.hasnext,
|
||||||
|
|
||||||
T.make_tuple: F.make_tuple,
|
T.MakeTuple: F.make_tuple,
|
||||||
T.make_dict: F.make_dict,
|
T.make_dict: F.make_dict,
|
||||||
T.make_list: F.make_list,
|
T.make_list: F.make_list,
|
||||||
T.make_slice: F.make_slice,
|
T.make_slice: F.make_slice,
|
||||||
|
|
|
@ -48,7 +48,7 @@ __all__ = ['add', 'sub', 'mul', 'truediv', 'floordiv', 'mod', 'eq', 'ne', 'lt',
|
||||||
'exp', 'log', 'sin', 'cos', 'tan']
|
'exp', 'log', 'sin', 'cos', 'tan']
|
||||||
|
|
||||||
|
|
||||||
def make_tuple(*elts): # pragma: no cover
|
def MakeTuple(*elts): # pragma: no cover
|
||||||
"""Tuple builder."""
|
"""Tuple builder."""
|
||||||
raise RuntimeError('This operation is not meant to be called directly.')
|
raise RuntimeError('This operation is not meant to be called directly.')
|
||||||
|
|
||||||
|
|
|
@ -2153,7 +2153,7 @@ class IrParser {
|
||||||
|
|
||||||
std::vector<ValuePtr> elems;
|
std::vector<ValuePtr> elems;
|
||||||
std::vector<AnfNodePtr> nodes;
|
std::vector<AnfNodePtr> nodes;
|
||||||
nodes.push_back(std::make_shared<ValueNode>(std::make_shared<Primitive>("make_tuple")));
|
nodes.push_back(std::make_shared<ValueNode>(std::make_shared<Primitive>("MakeTuple")));
|
||||||
ValuePtr elem = nullptr;
|
ValuePtr elem = nullptr;
|
||||||
AnfNodePtr node = nullptr;
|
AnfNodePtr node = nullptr;
|
||||||
bool node_is_valid = false;
|
bool node_is_valid = false;
|
||||||
|
|
|
@ -325,7 +325,7 @@ constexpr char UNIQUE[] = "Unique";
|
||||||
|
|
||||||
// Parallel don't care
|
// Parallel don't care
|
||||||
constexpr char STRING_EQUAL[] = "string_equal";
|
constexpr char STRING_EQUAL[] = "string_equal";
|
||||||
constexpr char MAKE_TUPLE[] = "make_tuple";
|
constexpr char MAKE_TUPLE[] = "MakeTuple";
|
||||||
constexpr char MAKE_LIST[] = "make_list";
|
constexpr char MAKE_LIST[] = "make_list";
|
||||||
constexpr char MAKE_DICT[] = "make_dict";
|
constexpr char MAKE_DICT[] = "make_dict";
|
||||||
constexpr char MAKE_SLICE[] = "make_slice";
|
constexpr char MAKE_SLICE[] = "make_slice";
|
||||||
|
|
|
@ -118,7 +118,7 @@ const char NAMED_PRIMITIVE_GETITEM[] = "getitem";
|
||||||
const char NAMED_PRIMITIVE_SETITEM[] = "setitem";
|
const char NAMED_PRIMITIVE_SETITEM[] = "setitem";
|
||||||
const char NAMED_PRIMITIVE_HASNEXT[] = "hasnext";
|
const char NAMED_PRIMITIVE_HASNEXT[] = "hasnext";
|
||||||
const char NAMED_PRIMITIVE_BOOL[] = "bool_"; // bool: P.identity
|
const char NAMED_PRIMITIVE_BOOL[] = "bool_"; // bool: P.identity
|
||||||
const char NAMED_PRIMITIVE_MAKETUPLE[] = "make_tuple";
|
const char NAMED_PRIMITIVE_MAKETUPLE[] = "MakeTuple";
|
||||||
const char NAMED_PRIMITIVE_MAKELIST[] = "make_list";
|
const char NAMED_PRIMITIVE_MAKELIST[] = "make_list";
|
||||||
const char NAMED_PRIMITIVE_MAKESLICE[] = "make_slice";
|
const char NAMED_PRIMITIVE_MAKESLICE[] = "make_slice";
|
||||||
const char NAMED_PRIMITIVE_MAKEDICT[] = "make_dict";
|
const char NAMED_PRIMITIVE_MAKEDICT[] = "make_dict";
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace abstract {
|
||||||
using mindspore::parse::PyObjectWrapper;
|
using mindspore::parse::PyObjectWrapper;
|
||||||
|
|
||||||
std::unordered_set<std::string> prims_to_skip_undetermined_infer{
|
std::unordered_set<std::string> prims_to_skip_undetermined_infer{
|
||||||
"make_tuple", "make_list", "switch", "env_setitem", "env_getitem", "Load", "UpdateState"};
|
"MakeTuple", "make_list", "switch", "env_setitem", "env_getitem", "Load", "UpdateState"};
|
||||||
|
|
||||||
EvalResultPtr DoSignatureEvaluator::Run(AnalysisEnginePtr engine, const ConfigPtrList &args_conf_list,
|
EvalResultPtr DoSignatureEvaluator::Run(AnalysisEnginePtr engine, const ConfigPtrList &args_conf_list,
|
||||||
AnfNodeConfigPtr out_conf) {
|
AnfNodeConfigPtr out_conf) {
|
||||||
|
|
|
@ -625,7 +625,7 @@ void DfGraphConvertor::TraceOutput(const AnfNodePtr node) {
|
||||||
name = GetCNodeTargetFuncName(c);
|
name = GetCNodeTargetFuncName(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == "make_tuple") {
|
if (name == "MakeTuple") {
|
||||||
for (unsigned int i = 1; i < c->inputs().size(); i++) {
|
for (unsigned int i = 1; i < c->inputs().size(); i++) {
|
||||||
TraceOutput(c->input(i));
|
TraceOutput(c->input(i));
|
||||||
}
|
}
|
||||||
|
|
|
@ -264,7 +264,7 @@ inline const PrimitivePtr kPrimMomentum = std::make_shared<Primitive>("Momentum"
|
||||||
inline const PrimitivePtr kPrimApplyMomentum = std::make_shared<Primitive>("ApplyMomentum");
|
inline const PrimitivePtr kPrimApplyMomentum = std::make_shared<Primitive>("ApplyMomentum");
|
||||||
inline const PrimitivePtr kPrimApplyFtrl = std::make_shared<Primitive>("ApplyFtrl");
|
inline const PrimitivePtr kPrimApplyFtrl = std::make_shared<Primitive>("ApplyFtrl");
|
||||||
inline const PrimitivePtr kPrimLayerNorm = std::make_shared<Primitive>("LayerNorm");
|
inline const PrimitivePtr kPrimLayerNorm = std::make_shared<Primitive>("LayerNorm");
|
||||||
inline const PrimitivePtr kPrimLrn = std::make_shared<Primitive>("Lrn");
|
inline const PrimitivePtr kPrimLrn = std::make_shared<Primitive>("LRN");
|
||||||
inline const PrimitivePtr kPrimLayerNormGrad = std::make_shared<Primitive>("LayerNormGrad");
|
inline const PrimitivePtr kPrimLayerNormGrad = std::make_shared<Primitive>("LayerNormGrad");
|
||||||
inline const PrimitivePtr kPrimLayerNormXBackprop = std::make_shared<Primitive>("LayerNormXBackprop");
|
inline const PrimitivePtr kPrimLayerNormXBackprop = std::make_shared<Primitive>("LayerNormXBackprop");
|
||||||
inline const PrimitivePtr kPrimLayerNormBetaGammaBackprop = std::make_shared<Primitive>("LayerNormBetaGammaBackprop");
|
inline const PrimitivePtr kPrimLayerNormBetaGammaBackprop = std::make_shared<Primitive>("LayerNormBetaGammaBackprop");
|
||||||
|
@ -410,7 +410,7 @@ inline const PrimitivePtr kPrimAssignSub = std::make_shared<Primitive>("AssignSu
|
||||||
inline const PrimitivePtr kPrimSelect = std::make_shared<Primitive>("Select");
|
inline const PrimitivePtr kPrimSelect = std::make_shared<Primitive>("Select");
|
||||||
inline const PrimitivePtr kPrimCall = std::make_shared<Primitive>("call");
|
inline const PrimitivePtr kPrimCall = std::make_shared<Primitive>("call");
|
||||||
|
|
||||||
inline const PrimitivePtr kPrimMakeTuple = std::make_shared<Primitive>("make_tuple");
|
inline const PrimitivePtr kPrimMakeTuple = std::make_shared<Primitive>("MakeTuple");
|
||||||
inline const PrimitivePtr kPrimMakeSlice = std::make_shared<Primitive>("make_slice");
|
inline const PrimitivePtr kPrimMakeSlice = std::make_shared<Primitive>("make_slice");
|
||||||
inline const PrimitivePtr kPrimTupleGetItem = std::make_shared<Primitive>(kTupleGetItem);
|
inline const PrimitivePtr kPrimTupleGetItem = std::make_shared<Primitive>(kTupleGetItem);
|
||||||
inline const PrimitivePtr kPrimArrayGetItem = std::make_shared<Primitive>("array_getitem");
|
inline const PrimitivePtr kPrimArrayGetItem = std::make_shared<Primitive>("array_getitem");
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
namespace mindspore {
|
namespace mindspore {
|
||||||
namespace ops {
|
namespace ops {
|
||||||
constexpr auto kNameLRN = "Lrn";
|
constexpr auto kNameLRN = "LRN";
|
||||||
class LRN : public PrimitiveC {
|
class LRN : public PrimitiveC {
|
||||||
public:
|
public:
|
||||||
LRN() : PrimitiveC(kNameLRN) { InitIOName({"x"}, {"y"}); }
|
LRN() : PrimitiveC(kNameLRN) { InitIOName({"x"}, {"y"}); }
|
||||||
|
|
|
@ -132,7 +132,7 @@ tuple_len = Primitive("tuple_len")
|
||||||
list_len = Primitive("list_len")
|
list_len = Primitive("list_len")
|
||||||
tuple_reversed = Primitive("tuple_reversed")
|
tuple_reversed = Primitive("tuple_reversed")
|
||||||
make_range = Primitive("make_range")
|
make_range = Primitive("make_range")
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
make_dict = Primitive('make_dict')
|
make_dict = Primitive('make_dict')
|
||||||
make_list = Primitive('make_list')
|
make_list = Primitive('make_list')
|
||||||
make_slice = Primitive('make_slice')
|
make_slice = Primitive('make_slice')
|
||||||
|
|
|
@ -38,7 +38,7 @@ def first_connected(sp, space):
|
||||||
nodes = [sp.nodes[i] for i in cand[0]]
|
nodes = [sp.nodes[i] for i in cand[0]]
|
||||||
graphs = sp.resolve_connnected_graphs(nodes)
|
graphs = sp.resolve_connnected_graphs(nodes)
|
||||||
if len(graphs) != 1:
|
if len(graphs) != 1:
|
||||||
print("connect check faied: ", nodes)
|
print("connect check failed: ", nodes)
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ def graph_pat_7():
|
||||||
a1 = gb.tensor([1024, 1024], "float32", name="a1")
|
a1 = gb.tensor([1024, 1024], "float32", name="a1")
|
||||||
a = gb.emit("Abs", a0, 'a')
|
a = gb.emit("Abs", a0, 'a')
|
||||||
b = gb.emit("Abs", a1, 'b')
|
b = gb.emit("Abs", a1, 'b')
|
||||||
c = gb.emit("make_tuple", [a, b], 'c')
|
c = gb.emit("MakeTuple", [a, b], 'c')
|
||||||
d = gb.tensor([1024, 1024], "float32", name="d")
|
d = gb.tensor([1024, 1024], "float32", name="d")
|
||||||
gb.op("AddN", d, [c])
|
gb.op("AddN", d, [c])
|
||||||
gb.emit("Abs", d, 'f')
|
gb.emit("Abs", d, 'f')
|
||||||
|
|
|
@ -173,7 +173,7 @@ TEST_F(TestOps, HasTypeTest) {
|
||||||
|
|
||||||
// Data structures
|
// Data structures
|
||||||
TEST_F(TestOps, MakeTupleTest) {
|
TEST_F(TestOps, MakeTupleTest) {
|
||||||
auto prim = std::make_shared<Primitive>("make_tuple");
|
auto prim = std::make_shared<Primitive>("MakeTuple");
|
||||||
ASSERT_EQ(prim->name(), kPrimMakeTuple->name());
|
ASSERT_EQ(prim->name(), kPrimMakeTuple->name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -579,7 +579,7 @@ def test_elim_sum_shape_one(tag):
|
||||||
def test_tuple_getitem(tag):
|
def test_tuple_getitem(tag):
|
||||||
""" test_tuple_getitem """
|
""" test_tuple_getitem """
|
||||||
fns = FnDict()
|
fns = FnDict()
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
|
|
||||||
@fns
|
@fns
|
||||||
def make_get_0(x, y):
|
def make_get_0(x, y):
|
||||||
|
@ -603,7 +603,7 @@ def test_tuple_getitem(tag):
|
||||||
def test_tuple_setitem(tag):
|
def test_tuple_setitem(tag):
|
||||||
""" test_tuple_setitem """
|
""" test_tuple_setitem """
|
||||||
fns = FnDict()
|
fns = FnDict()
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_setitem = Primitive('tuple_setitem')
|
tuple_setitem = Primitive('tuple_setitem')
|
||||||
|
|
||||||
@fns
|
@fns
|
||||||
|
@ -924,7 +924,7 @@ def test_convert_switch_ops(tag):
|
||||||
add = Primitive(Constants.kScalarAdd)
|
add = Primitive(Constants.kScalarAdd)
|
||||||
neg = Primitive('Neg')
|
neg = Primitive('Neg')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
|
|
||||||
@fns
|
@fns
|
||||||
def before(cond, x, y):
|
def before(cond, x, y):
|
||||||
|
@ -1032,7 +1032,7 @@ def test_reducesum_one(tag):
|
||||||
def test_print_tuple_wrapper(tag):
|
def test_print_tuple_wrapper(tag):
|
||||||
fns = FnDict()
|
fns = FnDict()
|
||||||
print_ = Primitive('Print')
|
print_ = Primitive('Print')
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
|
|
||||||
@fns
|
@fns
|
||||||
def before1(x, y):
|
def before1(x, y):
|
||||||
|
|
|
@ -25,7 +25,7 @@ RealDiv = P.RealDiv()
|
||||||
Sqrt = P.Sqrt()
|
Sqrt = P.Sqrt()
|
||||||
Square = P.Square()
|
Square = P.Square()
|
||||||
Assign = P.Assign()
|
Assign = P.Assign()
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
AdamApplyOne = Primitive('AdamApplyOne')
|
AdamApplyOne = Primitive('AdamApplyOne')
|
||||||
AdamApplyOneAssign = Primitive('AdamApplyOneAssign')
|
AdamApplyOneAssign = Primitive('AdamApplyOneAssign')
|
||||||
|
|
|
@ -25,7 +25,7 @@ sqrt = P.Sqrt()
|
||||||
real_div = P.RealDiv()
|
real_div = P.RealDiv()
|
||||||
sub = P.Sub()
|
sub = P.Sub()
|
||||||
Assign = P.Assign()
|
Assign = P.Assign()
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
adam_apply_one_with_decay = Primitive('AdamApplyOneWithDecay')
|
adam_apply_one_with_decay = Primitive('AdamApplyOneWithDecay')
|
||||||
adam_apply_one_with_decay_assign = Primitive('AdamApplyOneWithDecayAssign')
|
adam_apply_one_with_decay_assign = Primitive('AdamApplyOneWithDecayAssign')
|
||||||
|
|
|
@ -17,7 +17,7 @@ from mindspore.ops import Primitive
|
||||||
from mindspore.ops import operations as P
|
from mindspore.ops import operations as P
|
||||||
|
|
||||||
addn = P.AddN()
|
addn = P.AddN()
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
|
|
||||||
|
|
||||||
class FnDict:
|
class FnDict:
|
||||||
|
|
|
@ -16,7 +16,7 @@ from mindspore.ops import Primitive
|
||||||
from mindspore.ops import operations as P
|
from mindspore.ops import operations as P
|
||||||
from mindspore.ops import _constants as Constants
|
from mindspore.ops import _constants as Constants
|
||||||
|
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
BatchNorm = P.BatchNorm()
|
BatchNorm = P.BatchNorm()
|
||||||
BNTrainingReduce = Primitive('BNTrainingReduce')
|
BNTrainingReduce = Primitive('BNTrainingReduce')
|
||||||
|
|
|
@ -16,7 +16,7 @@ from mindspore.ops import Primitive
|
||||||
from mindspore.ops.operations import _grad_ops as G
|
from mindspore.ops.operations import _grad_ops as G
|
||||||
from mindspore.ops import _constants as Constants
|
from mindspore.ops import _constants as Constants
|
||||||
|
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
BatchNormGradTraining = G.BatchNormGrad(is_training=True)
|
BatchNormGradTraining = G.BatchNormGrad(is_training=True)
|
||||||
BatchNormGradInfer = G.BatchNormGrad(is_training=False)
|
BatchNormGradInfer = G.BatchNormGrad(is_training=False)
|
||||||
|
|
|
@ -20,7 +20,7 @@ from mindspore.ops import _constants as Constants
|
||||||
batch_norm_grad = G.BatchNormGrad(is_training=True)
|
batch_norm_grad = G.BatchNormGrad(is_training=True)
|
||||||
bn_training_update_grad = Primitive('BNTrainingUpdateGrad')
|
bn_training_update_grad = Primitive('BNTrainingUpdateGrad')
|
||||||
bn_training_reduce_grad = Primitive('BNTrainingReduceGrad')
|
bn_training_reduce_grad = Primitive('BNTrainingReduceGrad')
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ from mindspore.ops import _constants as Constants
|
||||||
|
|
||||||
batch_norm = P.BatchNorm(is_training=False)
|
batch_norm = P.BatchNorm(is_training=False)
|
||||||
bn_infer = Primitive('BNInfer')
|
bn_infer = Primitive('BNInfer')
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ from mindspore.ops import _constants as Constants
|
||||||
|
|
||||||
batch_norm_grad = G.BatchNormGrad(is_training=False)
|
batch_norm_grad = G.BatchNormGrad(is_training=False)
|
||||||
bn_infer_grad = Primitive('BNInferGrad')
|
bn_infer_grad = Primitive('BNInferGrad')
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ from mindspore.ops import _constants as Constants
|
||||||
from mindspore.common.tensor import Tensor
|
from mindspore.common.tensor import Tensor
|
||||||
import mindspore.common.dtype as mstype
|
import mindspore.common.dtype as mstype
|
||||||
|
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
bn_grad = G.BatchNormGrad(is_training=True)
|
bn_grad = G.BatchNormGrad(is_training=True)
|
||||||
sync_bn_grad = G.SyncBatchNormGrad()
|
sync_bn_grad = G.SyncBatchNormGrad()
|
||||||
|
|
|
@ -20,7 +20,7 @@ from mindspore.ops import _constants as Constants
|
||||||
from mindspore.common.tensor import Tensor
|
from mindspore.common.tensor import Tensor
|
||||||
import mindspore.common.dtype as mstype
|
import mindspore.common.dtype as mstype
|
||||||
|
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
bn = P.BatchNorm(is_training=True)
|
bn = P.BatchNorm(is_training=True)
|
||||||
sync_bn = inner.SyncBatchNorm()
|
sync_bn = inner.SyncBatchNorm()
|
||||||
|
|
|
@ -33,7 +33,7 @@ Fusion_matmul_relu = Primitive('FusionOp_MatMul_ReLU')
|
||||||
|
|
||||||
Add = P.Add()
|
Add = P.Add()
|
||||||
Sub = P.Sub()
|
Sub = P.Sub()
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
|
|
||||||
|
|
||||||
class FnDict:
|
class FnDict:
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
from mindspore.ops import Primitive
|
from mindspore.ops import Primitive
|
||||||
|
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
cast = Primitive('Cast')
|
cast = Primitive('Cast')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ maximum = P.Maximum()
|
||||||
sqrt = P.Sqrt()
|
sqrt = P.Sqrt()
|
||||||
greater = P.Greater()
|
greater = P.Greater()
|
||||||
clip_by_norm_no_div_square_sum = Primitive('ClipByNormNoDivSum')
|
clip_by_norm_no_div_square_sum = Primitive('ClipByNormNoDivSum')
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ from mindspore.ops import _constants as Constants
|
||||||
maximum = P.Maximum()
|
maximum = P.Maximum()
|
||||||
minimum = P.Minimum()
|
minimum = P.Minimum()
|
||||||
clip_by_value = Primitive('ClipByValue')
|
clip_by_value = Primitive('ClipByValue')
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ addn = P.AddN()
|
||||||
mul = P.Mul()
|
mul = P.Mul()
|
||||||
reduce_sum = P.ReduceSum()
|
reduce_sum = P.ReduceSum()
|
||||||
confusion_mul_grad = Primitive('ConfusionMulGrad')
|
confusion_mul_grad = Primitive('ConfusionMulGrad')
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
axis = 1
|
axis = 1
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ mul = P.Mul()
|
||||||
reduce_sum = P.ReduceSum(keep_dims=True)
|
reduce_sum = P.ReduceSum(keep_dims=True)
|
||||||
sub = P.Sub()
|
sub = P.Sub()
|
||||||
confusion_softmax_grad = Primitive('ConfusionSoftmaxGrad')
|
confusion_softmax_grad = Primitive('ConfusionSoftmaxGrad')
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
axis = 2
|
axis = 2
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ from mindspore.ops.operations import _grad_ops as G
|
||||||
|
|
||||||
stridedslicegrad = G.StridedSliceGrad()
|
stridedslicegrad = G.StridedSliceGrad()
|
||||||
backend_stridedslicegrad = Primitive('StridedSliceGrad')
|
backend_stridedslicegrad = Primitive('StridedSliceGrad')
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
|
|
||||||
|
|
||||||
class FnDict:
|
class FnDict:
|
||||||
|
|
|
@ -19,7 +19,7 @@ from mindspore.ops import Primitive
|
||||||
from mindspore.ops import operations as P
|
from mindspore.ops import operations as P
|
||||||
from mindspore.ops.operations import _grad_ops as G
|
from mindspore.ops.operations import _grad_ops as G
|
||||||
|
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
reshape = P.Reshape()
|
reshape = P.Reshape()
|
||||||
backend_reshape = Primitive('Reshape')
|
backend_reshape = Primitive('Reshape')
|
||||||
cast = P.Cast()
|
cast = P.Cast()
|
||||||
|
|
|
@ -18,7 +18,7 @@ from mindspore.common.tensor import Tensor
|
||||||
from mindspore.ops import Primitive
|
from mindspore.ops import Primitive
|
||||||
from mindspore.ops import operations as P
|
from mindspore.ops import operations as P
|
||||||
|
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
concat = P.Concat()
|
concat = P.Concat()
|
||||||
add = P.Add()
|
add = P.Add()
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ from mindspore.ops import Primitive
|
||||||
from mindspore.ops import operations as P
|
from mindspore.ops import operations as P
|
||||||
from mindspore.ops import _constants as Constants
|
from mindspore.ops import _constants as Constants
|
||||||
|
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_get_item = Primitive(Constants.kTupleGetItem)
|
tuple_get_item = Primitive(Constants.kTupleGetItem)
|
||||||
LSTM = P.LSTM(input_size=10, hidden_size=2, num_layers=1, has_bias=True, bidirectional=False, dropout=0.0)
|
LSTM = P.LSTM(input_size=10, hidden_size=2, num_layers=1, has_bias=True, bidirectional=False, dropout=0.0)
|
||||||
add = P.Add()
|
add = P.Add()
|
||||||
|
|
|
@ -20,7 +20,7 @@ relu = P.ReLU()
|
||||||
relu_grad = Primitive('ReluGrad')
|
relu_grad = Primitive('ReluGrad')
|
||||||
relu_v2 = Primitive('ReLUV2')
|
relu_v2 = Primitive('ReLUV2')
|
||||||
relu_grad_v2 = Primitive('ReluGradV2')
|
relu_grad_v2 = Primitive('ReluGradV2')
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ from mindspore.ops import operations as P
|
||||||
|
|
||||||
add = P.Add()
|
add = P.Add()
|
||||||
sub = P.Sub()
|
sub = P.Sub()
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
four2five = Primitive('Four2Five')
|
four2five = Primitive('Four2Five')
|
||||||
five2four = Primitive('Five2Four')
|
five2four = Primitive('Five2Four')
|
||||||
transdata = Primitive("TransData")
|
transdata = Primitive("TransData")
|
||||||
|
|
|
@ -23,7 +23,7 @@ from mindspore.ops import _constants as Constants
|
||||||
AssignSub = P.AssignSub()
|
AssignSub = P.AssignSub()
|
||||||
Mul = P.Mul()
|
Mul = P.Mul()
|
||||||
Sub = P.Sub()
|
Sub = P.Sub()
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
update_state = Primitive('UpdateState')
|
update_state = Primitive('UpdateState')
|
||||||
U = monad.U
|
U = monad.U
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
from mindspore.ops import Primitive
|
from mindspore.ops import Primitive
|
||||||
from mindspore.ops import _constants as Constants
|
from mindspore.ops import _constants as Constants
|
||||||
|
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ add = P.Add()
|
||||||
sub = P.Sub()
|
sub = P.Sub()
|
||||||
mul = P.Mul()
|
mul = P.Mul()
|
||||||
max_pool = P.MaxPoolWithArgmax(pad_mode="same", kernel_size=3, strides=2)
|
max_pool = P.MaxPoolWithArgmax(pad_mode="same", kernel_size=3, strides=2)
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
four2five = Primitive('Four2Five')
|
four2five = Primitive('Four2Five')
|
||||||
five2four = Primitive('Five2Four')
|
five2four = Primitive('Five2Four')
|
||||||
cast = Primitive('Cast')
|
cast = Primitive('Cast')
|
||||||
|
|
|
@ -20,7 +20,7 @@ from mindspore.ops import operations as P
|
||||||
|
|
||||||
get_next = P.GetNext([ms.float32, ms.int32], [[32, 64], [32]], 2, "")
|
get_next = P.GetNext([ms.float32, ms.int32], [[32, 64], [32]], 2, "")
|
||||||
memcpy_async = Primitive('memcpy_async')
|
memcpy_async = Primitive('memcpy_async')
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ depend = P.Depend()
|
||||||
all_reduce = P.AllReduce()
|
all_reduce = P.AllReduce()
|
||||||
broadcast = P.Broadcast(1)
|
broadcast = P.Broadcast(1)
|
||||||
memcpy_async = Primitive('memcpy_async')
|
memcpy_async = Primitive('memcpy_async')
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
assign_add = P.AssignAdd()
|
assign_add = P.AssignAdd()
|
||||||
apply_momentun = P.ApplyMomentum()
|
apply_momentun = P.ApplyMomentum()
|
||||||
|
|
|
@ -19,7 +19,7 @@ from mindspore.ops import _constants as Constants
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
add = P.Add()
|
add = P.Add()
|
||||||
max_pool = P.MaxPoolWithArgmax(pad_mode="same", kernel_size=3, strides=2)
|
max_pool = P.MaxPoolWithArgmax(pad_mode="same", kernel_size=3, strides=2)
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
transdata = Primitive("TransData")
|
transdata = Primitive("TransData")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
add = P.Add()
|
add = P.Add()
|
||||||
allreduce = P.AllReduce()
|
allreduce = P.AllReduce()
|
||||||
allreduce.add_prim_attr('fusion', 1)
|
allreduce.add_prim_attr('fusion', 1)
|
||||||
make_tuple = Primitive("make_tuple")
|
make_tuple = Primitive("MakeTuple")
|
||||||
conv = P.Conv2D(out_channel=64, kernel_size=7, mode=1, pad_mode="valid", pad=0, stride=1, dilation=1, group=1)
|
conv = P.Conv2D(out_channel=64, kernel_size=7, mode=1, pad_mode="valid", pad=0, stride=1, dilation=1, group=1)
|
||||||
bn = P.FusedBatchNorm()
|
bn = P.FusedBatchNorm()
|
||||||
relu = P.ReLU()
|
relu = P.ReLU()
|
||||||
|
|
|
@ -21,7 +21,7 @@ Mul = P.Mul()
|
||||||
RealDiv = P.RealDiv()
|
RealDiv = P.RealDiv()
|
||||||
Rsqrt = P.Rsqrt()
|
Rsqrt = P.Rsqrt()
|
||||||
Sqrt = P.Sqrt()
|
Sqrt = P.Sqrt()
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
LambNextMV = Primitive('LambNextMV')
|
LambNextMV = Primitive('LambNextMV')
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ Mul = P.Mul()
|
||||||
RealDiv = P.RealDiv()
|
RealDiv = P.RealDiv()
|
||||||
Rsqrt = P.Rsqrt()
|
Rsqrt = P.Rsqrt()
|
||||||
Sqrt = P.Sqrt()
|
Sqrt = P.Sqrt()
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
LambNextMVWithDecay = Primitive('LambNextMVWithDecay')
|
LambNextMVWithDecay = Primitive('LambNextMVWithDecay')
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ mul = P.Mul()
|
||||||
real_div = P.RealDiv()
|
real_div = P.RealDiv()
|
||||||
rsqrt = P.Rsqrt()
|
rsqrt = P.Rsqrt()
|
||||||
sqrt = P.Sqrt()
|
sqrt = P.Sqrt()
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
LambNextMVWithDecayV1 = Primitive('LambNextMVWithDecayV1')
|
LambNextMVWithDecayV1 = Primitive('LambNextMVWithDecayV1')
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ Add = P.Add()
|
||||||
Mul = P.Mul()
|
Mul = P.Mul()
|
||||||
Sqrt = P.Sqrt()
|
Sqrt = P.Sqrt()
|
||||||
Square = P.Square()
|
Square = P.Square()
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
LambNextRight = Primitive('LambNextRight')
|
LambNextRight = Primitive('LambNextRight')
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ real_div = P.RealDiv()
|
||||||
mul = P.Mul()
|
mul = P.Mul()
|
||||||
sub = P.Sub()
|
sub = P.Sub()
|
||||||
lamb_update_with_lr = Primitive('LambUpdateWithLR')
|
lamb_update_with_lr = Primitive('LambUpdateWithLR')
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ Mul = P.Mul()
|
||||||
RealDiv = P.RealDiv()
|
RealDiv = P.RealDiv()
|
||||||
Select = P.Select()
|
Select = P.Select()
|
||||||
Greater = P.Greater()
|
Greater = P.Greater()
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
LambUpdateWithLrV2 = Primitive('LambUpdateWithLrV2')
|
LambUpdateWithLrV2 = Primitive('LambUpdateWithLrV2')
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ from mindspore.ops import _constants as Constants
|
||||||
lars_v2 = Primitive('LarsV2')
|
lars_v2 = Primitive('LarsV2')
|
||||||
square_sum_all = Primitive('SquareSumAll')
|
square_sum_all = Primitive('SquareSumAll')
|
||||||
lars_v2_update = Primitive('LarsV2Update')
|
lars_v2_update = Primitive('LarsV2Update')
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ from mindspore.ops import Primitive
|
||||||
from mindspore.ops.operations import _grad_ops as G
|
from mindspore.ops.operations import _grad_ops as G
|
||||||
from mindspore.ops import _constants as Constants
|
from mindspore.ops import _constants as Constants
|
||||||
|
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
layer_norm_grad = G.LayerNormGrad()
|
layer_norm_grad = G.LayerNormGrad()
|
||||||
layer_norm_x_backprop = Primitive('LayerNormXBackprop')
|
layer_norm_x_backprop = Primitive('LayerNormXBackprop')
|
||||||
|
|
|
@ -17,7 +17,7 @@ from mindspore.ops import operations as P
|
||||||
|
|
||||||
MatMul = P.MatMul()
|
MatMul = P.MatMul()
|
||||||
BiasAdd = P.BiasAdd()
|
BiasAdd = P.BiasAdd()
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
|
|
||||||
|
|
||||||
class FnDict:
|
class FnDict:
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
from mindspore.ops import Primitive
|
from mindspore.ops import Primitive
|
||||||
|
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
four2five = Primitive('Four2Five')
|
four2five = Primitive('Four2Five')
|
||||||
five2four = Primitive('Five2Four')
|
five2four = Primitive('Five2Four')
|
||||||
cast = Primitive('Cast')
|
cast = Primitive('Cast')
|
||||||
|
|
|
@ -23,7 +23,7 @@ add = P.Add()
|
||||||
sub = P.Sub()
|
sub = P.Sub()
|
||||||
mul = P.Mul()
|
mul = P.Mul()
|
||||||
max_pool = P.MaxPoolWithArgmax(pad_mode="same", kernel_size=3, strides=2)
|
max_pool = P.MaxPoolWithArgmax(pad_mode="same", kernel_size=3, strides=2)
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
cast = Primitive('Cast')
|
cast = Primitive('Cast')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ Mul = P.Mul()
|
||||||
ApplyMomentum = P.ApplyMomentum()
|
ApplyMomentum = P.ApplyMomentum()
|
||||||
FusedMulApplyMomentum = Primitive('FusedMulApplyMomentum')
|
FusedMulApplyMomentum = Primitive('FusedMulApplyMomentum')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
constant = Tensor(1.0, mstype.float32)
|
constant = Tensor(1.0, mstype.float32)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ from mindspore.ops import _constants as Constants
|
||||||
add = P.Add()
|
add = P.Add()
|
||||||
mul = P.Mul()
|
mul = P.Mul()
|
||||||
fused_mul_add = Primitive('FusedMulAdd')
|
fused_mul_add = Primitive('FusedMulAdd')
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ from mindspore.ops import _constants as Constants
|
||||||
addn = P.AddN()
|
addn = P.AddN()
|
||||||
mul = P.Mul()
|
mul = P.Mul()
|
||||||
fused_mul_addn = Primitive('FusedMulAddN')
|
fused_mul_addn = Primitive('FusedMulAddN')
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
scalar = Tensor(1.0, mstype.float32)
|
scalar = Tensor(1.0, mstype.float32)
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ from mindspore.ops import operations as P
|
||||||
depend = P.Depend()
|
depend = P.Depend()
|
||||||
TransData = Primitive('TransData')
|
TransData = Primitive('TransData')
|
||||||
add = P.Add()
|
add = P.Add()
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
|
|
||||||
|
|
||||||
class FnDict:
|
class FnDict:
|
||||||
|
|
|
@ -17,7 +17,7 @@ from mindspore.ops import Primitive
|
||||||
from mindspore.ops import operations as P
|
from mindspore.ops import operations as P
|
||||||
from mindspore.ops import _constants as Constants
|
from mindspore.ops import _constants as Constants
|
||||||
|
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
reduce_min = P.ReduceMin(keep_dims=False)
|
reduce_min = P.ReduceMin(keep_dims=False)
|
||||||
reduce_min1 = Primitive('ReduceMin')
|
reduce_min1 = Primitive('ReduceMin')
|
||||||
|
|
|
@ -19,7 +19,7 @@ from mindspore.ops import _constants as Constants
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
add = P.Add()
|
add = P.Add()
|
||||||
max_pool = P.MaxPoolWithArgmax(pad_mode="same", kernel_size=3, strides=2)
|
max_pool = P.MaxPoolWithArgmax(pad_mode="same", kernel_size=3, strides=2)
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
trans_data = Primitive("TransData")
|
trans_data = Primitive("TransData")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ from mindspore.ops import operations as P
|
||||||
Transpose = P.Transpose()
|
Transpose = P.Transpose()
|
||||||
Reshape = P.Reshape()
|
Reshape = P.Reshape()
|
||||||
ConfusionTransposeD = Primitive('ConfusionTransposeD')
|
ConfusionTransposeD = Primitive('ConfusionTransposeD')
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
|
|
||||||
|
|
||||||
class FnDict:
|
class FnDict:
|
||||||
|
|
|
@ -16,7 +16,7 @@ from mindspore.ops import Primitive
|
||||||
from mindspore.ops import operations as P
|
from mindspore.ops import operations as P
|
||||||
from mindspore.ops import _constants as Constants
|
from mindspore.ops import _constants as Constants
|
||||||
|
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
BatchNorm = P.BatchNorm(is_training=True)
|
BatchNorm = P.BatchNorm(is_training=True)
|
||||||
BNTrainingReduce = Primitive('BNTrainingReduce')
|
BNTrainingReduce = Primitive('BNTrainingReduce')
|
||||||
|
|
|
@ -20,7 +20,7 @@ Mul = P.Mul()
|
||||||
ReduceSum = P.ReduceSum(keep_dims=True)
|
ReduceSum = P.ReduceSum(keep_dims=True)
|
||||||
Sub = P.Sub()
|
Sub = P.Sub()
|
||||||
SoftmaxGradExt = Primitive('SoftmaxGradExt')
|
SoftmaxGradExt = Primitive('SoftmaxGradExt')
|
||||||
MakeTuple = Primitive('make_tuple')
|
MakeTuple = Primitive('MakeTuple')
|
||||||
TupleGetItem = Primitive(Constants.kTupleGetItem)
|
TupleGetItem = Primitive(Constants.kTupleGetItem)
|
||||||
axes = (2, 3)
|
axes = (2, 3)
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ from mindspore.ops import operations as P
|
||||||
from mindspore.ops import _constants as Constants
|
from mindspore.ops import _constants as Constants
|
||||||
|
|
||||||
split = P.Split(0, 8)
|
split = P.Split(0, 8)
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
splitv = Primitive('SplitV')
|
splitv = Primitive('SplitV')
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ from mindspore.ops import Primitive
|
||||||
from mindspore.ops import operations as P
|
from mindspore.ops import operations as P
|
||||||
from mindspore.ops import _constants as Constants
|
from mindspore.ops import _constants as Constants
|
||||||
|
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
square = P.Square()
|
square = P.Square()
|
||||||
reduce_sum = P.ReduceSum()
|
reduce_sum = P.ReduceSum()
|
||||||
|
|
|
@ -18,7 +18,7 @@ from mindspore.ops import Primitive
|
||||||
|
|
||||||
stack = P.Stack()
|
stack = P.Stack()
|
||||||
concat = P.Concat()
|
concat = P.Concat()
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
|
|
||||||
|
|
||||||
class FnDict:
|
class FnDict:
|
||||||
|
|
|
@ -19,7 +19,7 @@ from mindspore.ops import _constants as Constants
|
||||||
tensor_scatter_update = P.TensorScatterUpdate()
|
tensor_scatter_update = P.TensorScatterUpdate()
|
||||||
tensor_move = Primitive('TensorMove')
|
tensor_move = Primitive('TensorMove')
|
||||||
scatter_nd_update = Primitive('ScatterNdUpdate')
|
scatter_nd_update = Primitive('ScatterNdUpdate')
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ from mindspore.ops import _constants as Constants
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
add = P.Add()
|
add = P.Add()
|
||||||
max_pool = P.MaxPoolWithArgmax(pad_mode="same", kernel_size=3, strides=2)
|
max_pool = P.MaxPoolWithArgmax(pad_mode="same", kernel_size=3, strides=2)
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
four2five = Primitive('Four2Five')
|
four2five = Primitive('Four2Five')
|
||||||
five2four = Primitive('Five2Four')
|
five2four = Primitive('Five2Four')
|
||||||
transdata = Primitive("TransData")
|
transdata = Primitive("TransData")
|
||||||
|
|
|
@ -18,7 +18,7 @@ from mindspore.ops import operations as P
|
||||||
Transpose = P.Transpose()
|
Transpose = P.Transpose()
|
||||||
Reshape = P.Reshape()
|
Reshape = P.Reshape()
|
||||||
ConfusionTransposeD = Primitive('ConfusionTransposeD')
|
ConfusionTransposeD = Primitive('ConfusionTransposeD')
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
|
|
||||||
|
|
||||||
class FnDict:
|
class FnDict:
|
||||||
|
|
|
@ -19,7 +19,7 @@ from mindspore.ops import _constants as Constants
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
add = P.Add()
|
add = P.Add()
|
||||||
max_pool = P.MaxPoolWithArgmax(pad_mode="same", kernel_size=3, strides=2)
|
max_pool = P.MaxPoolWithArgmax(pad_mode="same", kernel_size=3, strides=2)
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
transdata = Primitive("TransData")
|
transdata = Primitive("TransData")
|
||||||
Transpose = P.Transpose()
|
Transpose = P.Transpose()
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ from mindspore.ops import Primitive
|
||||||
from mindspore.ops import operations as P
|
from mindspore.ops import operations as P
|
||||||
from mindspore.ops import _constants as Constants
|
from mindspore.ops import _constants as Constants
|
||||||
|
|
||||||
make_tuple = Primitive('make_tuple')
|
make_tuple = Primitive('MakeTuple')
|
||||||
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
tuple_getitem = Primitive(Constants.kTupleGetItem)
|
||||||
unsorted_segment_sum = P.UnsortedSegmentSum()
|
unsorted_segment_sum = P.UnsortedSegmentSum()
|
||||||
num_segments = 4
|
num_segments = 4
|
||||||
|
|
|
@ -803,7 +803,7 @@ TEST_F(TestConvert, TestConvertGeTensor) {
|
||||||
TEST_F(TestConvert, TestConvertMakeTuple) {
|
TEST_F(TestConvert, TestConvertMakeTuple) {
|
||||||
FuncGraphPtr func_graph = std::make_shared<FuncGraph>();
|
FuncGraphPtr func_graph = std::make_shared<FuncGraph>();
|
||||||
std::vector<AnfNodePtr> inputs;
|
std::vector<AnfNodePtr> inputs;
|
||||||
inputs.push_back(NewValueNode(std::make_shared<Primitive>("make_tuple")));
|
inputs.push_back(NewValueNode(std::make_shared<Primitive>("MakeTuple")));
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
auto input = func_graph->add_parameter();
|
auto input = func_graph->add_parameter();
|
||||||
input->set_name("x" + std::to_string(i));
|
input->set_name("x" + std::to_string(i));
|
||||||
|
|
|
@ -274,12 +274,12 @@ def test_newparameter_pattern():
|
||||||
new_para_0 = NewParameter("Merlin", default_tensor0)
|
new_para_0 = NewParameter("Merlin", default_tensor0)
|
||||||
new_para_1 = NewParameter("Arthur", default_tensor1)
|
new_para_1 = NewParameter("Arthur", default_tensor1)
|
||||||
target_0 = Call(P.MatMul(), [new_para_0, new_para_1])
|
target_0 = Call(P.MatMul(), [new_para_0, new_para_1])
|
||||||
target = Call("make_tuple", [target_0])
|
target = Call("MakeTuple", [target_0])
|
||||||
return pattern, target
|
return pattern, target
|
||||||
transformed_repr = get_func_graph(softmax_model, inputs).get_return().expanded_str(5)
|
transformed_repr = get_func_graph(softmax_model, inputs).get_return().expanded_str(5)
|
||||||
unregiste_pass(softmax_addn_pass)
|
unregiste_pass(softmax_addn_pass)
|
||||||
assert "MatMul" in transformed_repr
|
assert "MatMul" in transformed_repr
|
||||||
assert "make_tuple" in transformed_repr
|
assert "MakeTuple" in transformed_repr
|
||||||
assert "Softmax" not in transformed_repr
|
assert "Softmax" not in transformed_repr
|
||||||
|
|
||||||
def test_imm_target():
|
def test_imm_target():
|
||||||
|
@ -296,12 +296,12 @@ def test_imm_target():
|
||||||
x = Any()
|
x = Any()
|
||||||
pattern = Call(P.Softmax(), [x])
|
pattern = Call(P.Softmax(), [x])
|
||||||
imm = Imm(0)
|
imm = Imm(0)
|
||||||
target_0 = Call("make_tuple", [pattern])
|
target_0 = Call("MakeTuple", [pattern])
|
||||||
target = Call(Constants.kTupleGetItem, [target_0, imm])
|
target = Call(Constants.kTupleGetItem, [target_0, imm])
|
||||||
return pattern, target
|
return pattern, target
|
||||||
transformed_repr = get_func_graph(softmax_model, inputs).get_return().expanded_str(5)
|
transformed_repr = get_func_graph(softmax_model, inputs).get_return().expanded_str(5)
|
||||||
unregiste_pass(softmax_pass)
|
unregiste_pass(softmax_pass)
|
||||||
assert "make_tuple" in transformed_repr
|
assert "MakeTuple" in transformed_repr
|
||||||
assert Constants.kTupleGetItem in transformed_repr
|
assert Constants.kTupleGetItem in transformed_repr
|
||||||
assert "Softmax" in transformed_repr
|
assert "Softmax" in transformed_repr
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ def test_gen_new_parameter():
|
||||||
softmax = P.Softmax()
|
softmax = P.Softmax()
|
||||||
pattern = Call(softmax, [x])
|
pattern = Call(softmax, [x])
|
||||||
|
|
||||||
target = Call("make_tuple", [pattern, new_para])
|
target = Call("MakeTuple", [pattern, new_para])
|
||||||
return pattern, target
|
return pattern, target
|
||||||
transformed_repr = get_func_graph(softmax_model, inputs).get_return().expanded_str(5)
|
transformed_repr = get_func_graph(softmax_model, inputs).get_return().expanded_str(5)
|
||||||
assert "Merlin" in transformed_repr
|
assert "Merlin" in transformed_repr
|
||||||
|
|
Loading…
Reference in New Issue