Commit 3362f2fa authored by Paul's avatar Paul
Browse files

Apply fixits

parent a5b9ca16
...@@ -431,13 +431,13 @@ struct broadcast ...@@ -431,13 +431,13 @@ struct broadcast
auto shape1 = inputs.at(1); auto shape1 = inputs.at(1);
auto shape0_lens = shape0.lens(); auto shape0_lens = shape0.lens();
auto shape1_lens = shape1.lens(); auto shape1_lens = shape1.lens();
auto shape0_strides = shape0.lens(); const auto& shape0_strides = shape0.lens();
auto shape1_strides = shape1.lens(); auto shape1_strides = shape1.lens();
if(std::all_of(shape0_lens.cbegin(), shape1_lens.cend(), [&](auto x) { return x == 1; })) if(std::all_of(shape0_lens.cbegin(), shape1_lens.cend(), [&](auto x) { return x == 1; }))
{ {
if(axis != 0) if(axis != 0)
RTG_THROW("when broadcasting tensor of size 1, axis should be 0"); RTG_THROW("when broadcasting tensor of size 1, axis should be 0");
std::vector<size_t> bcast_shape_lens = shape0_lens; const std::vector<size_t>& bcast_shape_lens = shape0_lens;
std::vector<size_t> bcast_shape_strides(bcast_shape_lens.size(), 0); std::vector<size_t> bcast_shape_strides(bcast_shape_lens.size(), 0);
return {t, bcast_shape_lens, bcast_shape_strides}; return {t, bcast_shape_lens, bcast_shape_strides};
} }
......
...@@ -13,7 +13,7 @@ void fred() ...@@ -13,7 +13,7 @@ void fred()
rtg::shape shape1{rtg::shape::float_type, {4, 3}}; rtg::shape shape1{rtg::shape::float_type, {4, 3}};
std::vector<size_t> shape0_lens = shape0.lens(); std::vector<size_t> shape0_lens = shape0.lens();
std::vector<size_t> shape1_lens = shape1.lens(); std::vector<size_t> shape1_lens = shape1.lens();
std::vector<size_t> shape0_strides = shape0.strides(); const std::vector<size_t>& shape0_strides = shape0.strides();
std::vector<size_t> shape1_strides = shape1.strides(); std::vector<size_t> shape1_strides = shape1.strides();
for(size_t i = 0; i < shape1.lens().size(); i++) for(size_t i = 0; i < shape1.lens().size(); i++)
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment