Commit dd5dec97 authored by wooway777's avatar wooway777
Browse files

issue/21 - removed a redundant validation

parent 93cd62d5
...@@ -275,13 +275,6 @@ std::shared_ptr<Tensor> Tensor::view(const std::vector<size_t> new_shape, const ...@@ -275,13 +275,6 @@ std::shared_ptr<Tensor> Tensor::view(const std::vector<size_t> new_shape, const
} }
std::shared_ptr<Tensor> Tensor::viewReshaped(const std::vector<size_t> new_shape) const { std::shared_ptr<Tensor> Tensor::viewReshaped(const std::vector<size_t> new_shape) const {
// First validate that the total number of elements matches
size_t current_elements = std::accumulate(_desc->shape().begin(), _desc->shape().end(),
1, std::multiplies<size_t>());
size_t new_elements = std::accumulate(new_shape.begin(), new_shape.end(),
1, std::multiplies<size_t>());
ASSERT_EQ(current_elements, new_elements);
// Create a copy of the current shape and strides // Create a copy of the current shape and strides
auto current_shape = _desc->shape(); auto current_shape = _desc->shape();
......
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