Skip to content

Conversation

@chengduoZH
Copy link
Contributor

@chengduoZH chengduoZH commented Nov 21, 2017

fix #5792

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

col_shape_vec[0] = input->dims()[1] / groups should be fine.

Copy link
Contributor Author

@chengduoZH chengduoZH Nov 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't get what we want.

  std::vector<int> vec_i({ 501, 502, 503 });

  std::vector<int> vec (8);
  vec[0]  = 12;
  vec.insert(vec.begin()+1, vec_i.begin(), vec_i.end());

If we write it in this way, vec is {12 501 502 503 0 0 0 0 0 0 0}.
But if we write it in the other way, vec is {12 501 502 503}.

  std::vector<int> vec (8);
  vec.assign(1, 12);
  vec.insert(vec.begin()+1, vec_i.begin(), vec_i.end());

Copy link
Contributor

@typhoonzero typhoonzero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM++

@chengduoZH chengduoZH merged commit e800c0d into PaddlePaddle:develop Nov 23, 2017
@chengduoZH chengduoZH deleted the fix_conv_op branch January 29, 2018 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vector::erase is generally an inefficient operation.

2 participants