use crate::{Matrix, Result, matrix::autograd};
pub fn reshape(input: &Matrix, shape: impl Into<Vec<usize>>) -> Result<Matrix> {
let output = input.reshape_view(shape.into())?;
autograd::record_reshape(input, &output)?;
Ok(output)
}
pub(crate) fn reshape_semantic_output(input: &Matrix, shape: Vec<usize>) -> Result<Matrix> {
let output = input.reshape_semantic_output(shape)?;
autograd::record_reshape(input, &output)?;
Ok(output)
}
pub(crate) fn reshape_backward(output_gradient: &Matrix, input_shape: &[usize]) -> Result<Matrix> {
output_gradient.reshape(input_shape.to_vec())
}