Mapminmax function

Hello. I should translate the following matlab code to pytorch:

var = mapminmax(X, 0, 1); 

I used:

from sklearn.preprocessing import MinMaxScaler
scaler = MinMaxScaler(feature_range=(0, 1))
var = = scaler.fit_transform(X)

but the values I get in pytorch are quite different to that of matlab. Do you know if there is an other way to perform it?

From the MATLAB docs:

Process matrices by mapping row minimum and maximum values to [-1 1]

I guess your scikit-learn approach is normalizing the entire array, so you might need to normalize the rows separately.
The question is also unrelated to PyTorch so you might get a faster and better answer on e.g. StackOverflow.