Skip to content

NArray dimension

NArray automatically computes dimension when you create an object.

You can check the dimension of your NArray using the ndim property.

import toynn from 'toynn';
const myNArray = toynn.NArray.arange(32).reshape(4, -1);
console.log(myNArray.ndim);
myNArray.ndim = 5; // ❌ invalid

You can only change the dimension by reshaping your NArray.