21#include "Validation.h"
48 validate(input_data,
"Input not ready");
50 "Input domain of Reshape is not Tensor");
52 std::unique_ptr<NodeData> reshape_data =
nullptr;
56 case loco::DataType::FLOAT32:
58 auto input_bufptr =
input_data->as_f32_bufptr();
65 for (uint32_t axis = 0; axis <
output_shape->rank(); ++axis)
70 auto reshape_bufptr = make_buffer<float, LexicalLayout>(*
output_shape);
72 float *input_ptr =
const_cast<float *
>(input_bufptr->base());
73 uint64_t input_len =
num_elements(*input_shape) *
sizeof(float);
75 float *output_ptr = reshape_bufptr.base();
78 memcpy(output_ptr, input_ptr, input_len);
84 throw std::runtime_error(
"NYI for this DataType");
87 assert(reshape_data !=
nullptr);
88 annot_data(reshape, std::move(reshape_data));
99 execute_node(reshape);
void resize(int dimensions_count)
const luci_interpreter::RuntimeShape output_shape
bool validate(Code *code)
void annot_domain(loco::Node *node, const loco::Domain &domain)
Wrapper to annotate domain to node. Cannot annotate unknown domain.
std::unique_ptr< NodeData > make_data(const NodeData::Buffer< DT > &buffer)
Copy buffer to make NodeData.
uint32_t num_elements(const Shape &shape)
The number of elements of a feature map of a given shape.
Buffer< T > make_buffer(const Shape &shape)
uint64_t num_elements(const Shape &)