![]() However, if mod(numel(I), imsize) = 0, then your error might be that you want imsize number of rows, and a number of columns that makes this possible. If mod(numel(I), imsize) ~= 0 then your imsize is definitely incorrect. So reshape(A, 2,, 3) will become a 2xNx3 matrix, where, for a matrix with 24 elements, N will be 4. Now, if you know you want N rows, but don't know exactly how many columns you have, you might use the syntax, that tells MATLAB to use as many columns as necessary to make the number of elements be equal. The number of elements in the output matrix will be proportional to the product of sz1, sz2. You can't make a 1x5 vector turn into a 2x3 vector, as one element would be missing. For this to be possible, you need to have the same number of elements in the input matrix as you have in the output matrix. torch.reshape PyTorch 1.10.0 documentation torch.reshape torch.reshape(input, shape) Tensor Returns a tensor with the same data and number of elements as input, but with the specified shape. All unspecified dimensions are represented by a input in Matlab while in Scilab they are given by a -1. What reshape does is to take the matrix A, straightens it out, and gives it a new size, that's determined by the 2nd, 3rd to the Nth argument. To get the same result for character string matrices in Scilab than in Matlab, convert Scilab character string matrices using mstr2sci. Let's start with the syntax used in the documentation: B = reshape(A,sz1.,szN)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |