24.02.1
|
Go to the documentation of this file.
46 const unsigned int num_elems_per_input_plane = original_input_shape[
width_idx] * original_input_shape[
height_idx];
47 const unsigned int num_channels = original_input_shape[
channel_idx];
48 const unsigned int factor_1 = is_nchw_to_nhwc ? num_elems_per_input_plane : num_channels;
49 const unsigned int factor_2 = is_nchw_to_nhwc ? num_channels : num_elems_per_input_plane;
51 const uint32_t num_elements =
src.num_elements();
53 #pragma omp parallel for
55 for(uint32_t i = 0; i < num_elements; ++i)
58 const Coordinates coords_out(coords_in.
x(), coords_in.
y() % factor_1 * factor_2 + coords_in.
y() / factor_1);
@ NCHW
Num samples, channels, height, width.
SimpleTensor< float > src
DataLayout
[DataLayout enum definition]
@ NHWC
Num samples, height, width, channels.
Coordinates index2coords(const TensorShape &shape, int index)
Convert a linear index into n-dimensional coordinates.
SimpleTensor< T > convert_fully_connected_weights(const SimpleTensor< T > &src, const TensorShape &original_input_shape, const DataLayout training_data_layout)
T x() const
Alias to access the size of the first dimension.
size_t get_data_layout_dimension_index(const DataLayout &data_layout, const DataLayoutDimension &data_layout_dimension)
Get the index of the given dimension.
Simple tensor object that stores elements in a consecutive chunk of memory.
int coords2index(const TensorShape &shape, const Coordinates &coord)
Convert n-dimensional coordinates into a linear index.
Copyright (c) 2017-2024 Arm Limited.
T y() const
Alias to access the size of the second dimension.