djuna commited on
Commit
f6d9192
·
verified ·
1 Parent(s): c5a77e0

calculatepossiblerange: allow quotient that is a multiple of 0.5

Browse files
Files changed (1) hide show
  1. index.html +7 -9
index.html CHANGED
@@ -128,17 +128,15 @@
128
  }
129
  });
130
 
131
- function calculatePossibleRangeSize(totalLayers, doWhatISay) {
132
- const possibleRangeSizes = [];
133
- for (let rangeSize = 1; rangeSize <= totalLayers; rangeSize++) {
134
- if (totalLayers % rangeSize === 0) {
135
- if (!doWhatISay && rangeSize % 2!== 0) {
136
- continue; // skip odd range sizes if doWhatISay is false
137
- }
138
- possibleRangeSizes.push(rangeSize);
139
  }
140
  }
141
- return possibleRangeSizes;
142
  }
143
 
144
  function generateConfig(totalLayers, rangeSize, nbParameters, model, doWhatISay) {
 
128
  }
129
  });
130
 
131
+ function calculatePossibleRangeSize(num) {
132
+ const divisors = [];
133
+ for (let i = 1; i <= num; i++) {
134
+ const quotient = num / i;
135
+ if (num % i === 0 || (quotient % 0.5 === 0 && quotient !== Math.floor(quotient))) {
136
+ divisors.push(i);
 
 
137
  }
138
  }
139
+ return divisors.sort((a, b) => a - b);
140
  }
141
 
142
  function generateConfig(totalLayers, rangeSize, nbParameters, model, doWhatISay) {