Commit a402c83f authored by Ted Themistokleous's avatar Ted Themistokleous
Browse files

Remove length based shape jit constructor and calculate_strides()

These work in tandem to create a shape via the calculate strides() call. Seemed
to introduce more issues than fix, since we don't have access to resize()

Right now this is cleanup but I had used rev_partial_sum and the multiplies()
template operator created in algorithm to achieve this during debugging for
gather. The idea here would be we would statically create array() with calculate_strides()
to fix the empty stride dimensions.
parent 11e7e0d0
......@@ -39,23 +39,8 @@ struct shape
constexpr shape() = default;
constexpr shape(Lens l) : lens(l) {shape{}.calculate_strides();}
constexpr shape(Lens l, Strides s) : lens(l), strides(s) {}
constexpr auto calculate_strides()
{
strides.resize(lens.size(), 0);
if(strides.empty())
return;
strides.back() = 1;
partial_sum(lens.rbegin(),
lens.rend() - 1,
strides.rbegin() + 1,
multiplies());
}
constexpr auto elements() const { return _c<Lens{}.product()>; }
constexpr auto element_space() const { return _c<Strides{}.dot(Lens{} - 1) + 1>; }
......
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