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

Commit

Permalink
Change usage of Reshape in cpp-package
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-haibin-lin committed Apr 15, 2017
1 parent 294790a commit 96eb4f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions cpp-package/example/charRNN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Symbol LSTMUnroll(int num_lstm_layer, int sequence_length, int input_dim,

auto label = Symbol::Variable("softmax_label");
label = transpose(label);
label = Reshape(label, Shape(), false, false, Shape(-1)); // -1: infer from graph
label = Reshape(label, Shape(), false, Shape(-1), false); // -1: infer from graph
auto sm = SoftmaxOutput("softmax", pred, label);
if (isTrain)
return sm;
Expand All @@ -141,7 +141,7 @@ Symbol LSTMWithBuiltInRNNOp(int num_lstm_layer, int sequence_length, int input_d
auto label = Symbol::Variable("softmax_label");
label = transpose(label);
label = Reshape(label, Shape(), false,
false, Shape(-1)); // FullyConnected requires one dimension
Shape(-1), false); // FullyConnected requires one dimension
if (!TIME_MAJOR && isTrain)
embed = SwapAxis(embed, 0, 1); // Change to time-major as cuDNN requires

Expand All @@ -151,7 +151,7 @@ Symbol LSTMWithBuiltInRNNOp(int num_lstm_layer, int sequence_length, int input_d
auto rnn_params = Symbol::Variable("LSTM_parameters"); // See explanations near RNNXavier class
auto rnn = RNN(embed, rnn_params, rnn_h_init, rnn_c_init, num_hidden, num_lstm_layer,
RNNMode::lstm, false, dropout, !isTrain);
auto hidden = Reshape(rnn[0], Shape(), false, false, Shape(-1, num_hidden));
auto hidden = Reshape(rnn[0], Shape(), false, Shape(-1, num_hidden), false);

auto cls_weight = Symbol::Variable("cls_weight");
auto cls_bias = Symbol::Variable("cls_bias");
Expand Down
8 changes: 4 additions & 4 deletions src/operator/tensor/matrix_op-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ struct ReshapeParam : public dmlc::Parameter<ReshapeParam> {
DMLC_DECLARE_FIELD(shape)
.set_default(nnvm::Tuple<int>())
.describe("The target shape");
DMLC_DECLARE_FIELD(keep_highest).set_default(false)
.describe("(Deprecated! Use ``shape`` instead.) Whether keep the highest dim unchanged."
"If set to true, then the first dim in target_shape is ignored,"
"and always fixed as input");
DMLC_DECLARE_FIELD(reverse)
.set_default(false)
.describe("If true then the special values are inferred from right to left");
Expand All @@ -44,6 +40,10 @@ struct ReshapeParam : public dmlc::Parameter<ReshapeParam> {
.describe("(Deprecated! Use ``shape`` instead.) "
"Target new shape. One and only one dim can be 0, "
"in which case it will be inferred from the rest of dims");
DMLC_DECLARE_FIELD(keep_highest).set_default(false)
.describe("(Deprecated! Use ``shape`` instead.) Whether keep the highest dim unchanged."
"If set to true, then the first dim in target_shape is ignored,"
"and always fixed as input");
}
};

Expand Down

0 comments on commit 96eb4f5

Please sign in to comment.