提交 509d3209 编写于 作者: Y Yu Yang

Fix CI and style

上级 610a2584
......@@ -31,7 +31,7 @@ static void ForEachVarName(Map& names, T callback) {
}
static bool AllInSet(
const std::unordered_map<std::string, std::vector<std::string>>& names,
const std::map<std::string, std::vector<std::string>>& names,
const std::string& suffix, const std::unordered_set<std::string>& set) {
bool all_in_set = true;
ForEachVarName(names, [&all_in_set, &set, &suffix](const std::string& n) {
......
......@@ -68,10 +68,9 @@ REGISTER_GRADIENT_OP(io_ignored, io_ignored_grad, f::NOP);
TEST(GradOpBuilder, MutiInOut) {
std::shared_ptr<f::OperatorBase> test_op(f::OpRegistry::CreateOp(
"mult_io",
{{"In1", {"in1"}},
{"In2_mult", {"in2_1", "in2_2", "in2_3"}},
{"In3", {"in3"}}},
"mult_io", {{"In1", {"in1"}},
{"In2_mult", {"in2_1", "in2_2", "in2_3"}},
{"In3", {"in3"}}},
{{"Out1", {"out1"}}, {"Out2_mult", {"out2_1", "out2_2"}}}, {}));
std::shared_ptr<f::OperatorBase> grad_test_op =
f::OpRegistry::CreateGradOp(*test_op);
......@@ -101,10 +100,9 @@ TEST(GradOpBuilder, MutiInOut) {
TEST(GradOpBuilder, IOIgnoredInGradient) {
std::shared_ptr<f::OperatorBase> test_op(f::OpRegistry::CreateOp(
"io_ignored",
{{"In1", {"in1"}},
{"In2_mult", {"in2_1", "in2_2"}},
{"In3_mult", {"in3_1", "in3_2"}}},
"io_ignored", {{"In1", {"in1"}},
{"In2_mult", {"in2_1", "in2_2"}},
{"In3_mult", {"in3_1", "in3_2"}}},
{{"Out1_mult", {"out1_1", "out1_2"}}, {"Out2", {"out2"}}}, {}));
std::shared_ptr<f::OperatorBase> grad_test_op =
f::OpRegistry::CreateGradOp(*test_op);
......
......@@ -118,7 +118,7 @@ class OpProtoAndCheckerMaker {
class OpRegistry {
using OpCreator = std::function<OperatorBase*()>;
using VarNameMap = std::unordered_map<std::string, std::vector<std::string>>;
using VarNameMap = std::map<std::string, std::vector<std::string>>;
public:
template <typename OpType, typename ProtoMakerType>
......
......@@ -143,11 +143,11 @@ class OperatorBase {
// I (Inputs)
// O (Outputs)
// OG (Output Gradients)
std::unordered_map<std::string, std::vector<std::string>> inputs_;
std::map<std::string, std::vector<std::string>> inputs_;
// NOTE: in case of OpGrad, outputs_ contains
// IG (Inputs Gradients)
std::unordered_map<std::string, std::vector<std::string>> outputs_;
std::map<std::string, std::vector<std::string>> outputs_;
AttributeMap attrs_;
};
......
......@@ -57,15 +57,17 @@ void ExposeOperator(ClassType &m) {
})
.def("outputs",
[](const typename ClassType::type &op)
-> std::unordered_map<std::string, std::vector<std::string>> {
-> std::map<std::string, std::vector<std::string>> {
return op.outputs_;
})
.def("inputs",
[](const typename ClassType::type &op) { return op.inputs_; })
.def("__str__", &ClassType::type::DebugString)
.def("no_intermediate_outputs", [](const typename ClassType::type &op) {
return op.OutputVars(false);
});
.def("no_intermediate_outputs",
[](const typename ClassType::type &op) {
return op.OutputVars(false);
})
.def("support_gpu", &ClassType::type::SupportGPU);
}
static size_t UniqueIntegerGenerator() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册