| nn_build_reshape_op | R Documentation |
Shared by the sequential and functional builds.
nn_build_reshape_op(ctx, input_tensor, shape, input_shape)
ctx |
Compute context. |
input_tensor |
Input |
shape |
Resolved per-sample output shape (no '-1' left). |
input_shape |
Per-sample input shape. |
The batch is appended as the trailing ggml axis, and is derived from the
element count rather than from ggml_n_dims(): ggml reports a trailing
unit dimension as absent, so a batch of 1 would otherwise be read off a real
axis (the same reasoning as in [nn_build_flatten()]).
ggml_reshape_*() asserts that its input is contiguous, and an assert
aborts the process instead of raising an R error, so a non-contiguous input
(a permute that was not followed by ggml_cont(), say) is made
contiguous first.
A ggml_tensor viewing the input under the new shape.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.