This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix LinearRegressionOutput with empty label
- Loading branch information
haohuw
committed
Jul 22, 2019
1 parent
9a1a102
commit 8447052
Showing
4 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include <iostream> | ||
#include <vector> | ||
#include <string> | ||
#include "mxnet-cpp/MxNetCpp.h" | ||
|
||
using namespace mxnet::cpp; | ||
|
||
|
||
int main() { | ||
std::cout << "Running regress label test" << std::endl; | ||
Symbol data = Symbol::Variable("data"); | ||
Symbol label = Symbol::Variable("regress_label"); | ||
Symbol symbol = LinearRegressionOutput(data, label); | ||
std::map<std::string, mxnet::cpp::OpReqType> opReqMap; | ||
for (const auto& iter : symbol.ListArguments()) { | ||
opReqMap[iter] = mxnet::cpp::OpReqType::kNullOp; | ||
} | ||
std::map<std::string, mxnet::cpp::NDArray> argMap({ | ||
{"data", NDArray(Shape{1, 3}, Context::cpu(), true)} | ||
}); | ||
|
||
try { | ||
symbol.SimpleBind(Context::cpu(), | ||
argMap, | ||
std::map<std::string, mxnet::cpp::NDArray>(), | ||
opReqMap, | ||
std::map<std::string, mxnet::cpp::NDArray>()); | ||
} catch (const std::exception& e) { | ||
std::cout << "Error while binding in mxnet: " << MXGetLastError() << std::endl; | ||
throw; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters