Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Fix lint and unrelated compiler warning
Browse files Browse the repository at this point in the history
  • Loading branch information
leezu committed Feb 10, 2020
1 parent a7077de commit 72df483
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
12 changes: 6 additions & 6 deletions include/mxnet/imperative.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ class Imperative {

/*! \brief DCInfo datastructure to enable deferred computation */
class DCInfo {
public:
explicit DCInfo() {
public:
DCInfo() {
// Default constructor provided for the sake of any.h. Should not be used.
throw std::invalid_argument("Unsupported default constructor");
};
}
explicit DCInfo(const std::vector<NDArray *> &inputs,
const std::vector<NDArray *> &outputs);

Expand All @@ -121,7 +121,7 @@ class Imperative {
const std::vector<NDArray *> &inputs,
const std::vector<NDArray *> &outputs);

private:
private:
friend class Imperative;

/*! \brief Copies of input NDArrays
Expand Down Expand Up @@ -225,8 +225,8 @@ class Imperative {
std::vector<bool>* p_save_outputs = nullptr);
/*! \brief to record operator, return corresponding node. */
void RecordDeferredCompute(nnvm::NodeAttrs&& attrs,
std::vector<NDArray*>& inputs,
std::vector<NDArray*>& outputs);
const std::vector<NDArray*>& inputs,
const std::vector<NDArray*>& outputs);
/*! \brief obtain symbol representation of deferred compute session. */
nnvm::Symbol *GetDeferredComputeSymbol(
const std::vector<std::pair<NDArray *, std::string>> &inputs,
Expand Down
2 changes: 1 addition & 1 deletion src/imperative/cached_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ void SetInputIndices(const nnvm::Graph& fwd_graph,
const auto& indexed_graph = fwd_graph.indexed_graph();
if (data_indices->ndim() || param_indices.ndim()) {
CHECK_EQ(data_indices->ndim() + param_indices.ndim(),
indexed_graph.input_nodes().size());
static_cast<const int>(indexed_graph.input_nodes().size()));
} else {
std::vector<uint32_t> tmp;
tmp.reserve(indexed_graph.input_nodes().size());
Expand Down
9 changes: 5 additions & 4 deletions src/imperative/imperative.cc
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ void Imperative::RecordOp(
}
inputs[i]->autograd_entry_ = std::move(entry); // assign last to prevent cyclic reference
} else if (save_inputs[i]) {
AGInfo::Get(inputs[i]->autograd_entry_.node).outputs[inputs[i]->autograd_entry_.index] = inputs[i]->Detach();
nnvm::NodeEntry& entry = inputs[i]->autograd_entry_;
AGInfo::Get(entry.node).outputs[entry.index] = inputs[i]->Detach();
}
node->inputs[i] = inputs[i]->autograd_entry_;
}
Expand All @@ -292,8 +293,8 @@ void Imperative::RecordOp(
}

void Imperative::RecordDeferredCompute(nnvm::NodeAttrs &&attrs,
std::vector<NDArray *> &inputs,
std::vector<NDArray *> &outputs) {
const std::vector<NDArray *> &inputs,
const std::vector<NDArray *> &outputs) {
CHECK(!is_recording())
<< "Autograd recording is not supported during deferred compute mode.";

Expand Down Expand Up @@ -346,7 +347,7 @@ nnvm::Symbol *Imperative::GetDeferredComputeSymbol(
std::unordered_set<const NDArray *> missing_inputs;
auto add_symbol_variables = [&inputs, &ndinput_to_variable,
&missing_inputs](const nnvm::ObjectPtr &node) {
if(node == nullptr) {
if (node == nullptr) {
// This (nonexistant) "Node" belongs to an array created outside of deferred compute scope.
return;
}
Expand Down

0 comments on commit 72df483

Please sign in to comment.