Generated Computers
Locals는 Apple Silicon 엔진으로 로컬 LLM을 최대 3배 빠르게 실행하는 Generated Computers 제품
아직 감지된 업데이트가 없습니다. GitHub 릴리스가 나오면 여기에 보입니다.
개인 계정의 공개 저장소 소유자는 GitHub로 로그인해 운영자를 확인하고 소개를 직접 관리할 수 있습니다. 관리자 승인은 필요하지 않습니다.
로그인한 뒤 확인 파일을 만들어 이 저장소의 기본 브랜치에 30분 안에 커밋해 주세요. 다른 브랜치나 포크의 파일은 인정하지 않습니다. 파일을 올린 뒤 아래에서 확인하면 관리자 승인 없이 관리할 수 있습니다. 자격을 유지하려면 파일을 남겨 두세요.
로그인이 필요하면 로그인 화면으로 이동합니다. 로그인 후 이곳으로 돌아와 원하는 확인 버튼을 다시 눌러 주세요.
프로젝트 폴더에서 /nomorevibe verify를 실행하면 소유권을 확인하고 소개를 직접 관리할 수 있습니다.
1분 만에 확인하기Javascript library for n-dimensional arrays with numpy syntax
저장소 README에서 가져옴
README 전체를 불러오는 중입니다.
README 전문 보기 ↗ndarray-js is a reimplementation of numpy for javascript that aims to make the coding experience as similar to numpy as possible.
Documentation and interactive demo: click here.
The library implements a large subset of numpy operations (see the documentation website)
// Feature 1: A parsing system that can interpret numpy code as ndarray-js instructions
x = np`np.exp(0.5 * np.linspace(0, 1, 100).reshape(5, 4, 5)).mean(axis=0)`
y = np`(${x} * ${x}) / 2`
// Equivalent code:
x = np.exp(0.5 * np.linspace(0, 1, 100).reshape(5, 4, 5)).mean({axis:0})
y = np.divide(np.multiply(x * x), 2)
// Feature 2. Handling of args and kwargs following numpy order
x = np.geomspace(1, 10, 100).reshape([10,10])
x.mean({axis: -1, keepdims: true})
x.mean(-1, true)
x.mean(-1, {keepdims: true})
np.mean(x, {axis: -1})
// Feature 3. All types of indexing: (number, start:end:step, ':', '...', list of indices, NDArray boolean mask, NDArray boolean mask, NDArray indices)
y = x.index(2, ':', mask, '...', indices, '-1:-1:-2', -1);
y = np`${x}[2, :, ${mask}, ..., ${indices}, -1:-1:-2, -1]`;
// Feature 4. Broadcasting:
mu = np.array([1.5, 0]);
x = np.random.randn([100, 2]).add(x);
norm = x.pow(2).sum({axis: -1}).pow(0.5);
x.divide_assign(norm.index(':', 'None'));
for(let point2d of x){
console.log(point2d.tolist(), point2d.norm(), point2d.max());
if(np.all(point2d.equal(x.index(5)))) break;
}
// Feature 5. Most of numpy: all numeric dtypes (int8..uint64, float16..64, complex64/128), linalg, fft,
// numpy.polynomial, strings/char, npy/npz/text I/O, format_float_*, numpy-exact printing, and seeded random
// streams that reproduce numpy's (np.random.seed, RandomState, default_rng/PCG64 + SeedSequence).
np.random.seed(0);
np.random.rand(3); // [0.5488135, 0.71518937, 0.60276338], like numpy
np.random.default_rng(0).integers(0, 10, 5); // [0, 0, 1, 8, 6], like numpy
np.linalg.eigvals([[0, -1], [1, 0]]); // complex128, like numpy
np.fft.fft(np.arange(8));
Numpy-js can be used in:
<script src="https://cdn.jsdelivr.net/npm/ndarray-js@latest/dist/index.js"></script>npm install ndarray-jsCheck the documentation website for details.
'YYYY-MM-DD' strings).
sum, prod and cumsum of ints/bools are int64, like in numpy.2 from 2.0: np.array([1, 2]) is int32. Inside the template parser, float literals are kept as floats: np`np.array([1., 2])` is float64.npnp.arange(3) - np.arange(3).mean()`` is float, as in numpy).keepdims as the third argument: x.sum(axis, keepdims, dtype, out).np.array([1, 2], 'float32') + 1.5 stays float32.npm install --legacy-peer-deps
npx vitest run # unit tests, and differential tests against real numpy
NDARRAYJS_PYTHON=/path/to/venv/bin/python npx vitest run # python with numpy installed (default: python3)
The tests in tests/numpy/ evaluate the same numpy expression with python/numpy and with ndarray-js
(through its numpy-syntax parser) and compare values, shapes and dtype kinds (and that both raise on invalid input).
They are skipped when numpy is not available. Besides hand-written cases there are generated matrices
(every ufunc x dtypes x broadcasting, every reduction x axes/keepdims, ...), random expression chains
(tests/tools/gen_fuzz.py) and random indexed assignments through views (tests/tools/gen_fuzz_assign.py).
tests/types/ holds type-level checks of the public API (npm run typecheck), tests/unit/ JS-only behaviour and
performance sanity checks.
Not provided (yet):
numpy.ma (masked arrays), datetime64/timedelta64 and structured dtypes (the business-day functions work on 'YYYY-MM-DD' strings).Generator.multivariate_hypergeometric(method='count').Beyond numpy, np.group_by(keys, values?, axis?, func?) splits values by the distinct entries of keys:
const g = np.group_by(['b', 'a', 'b'], [10, 20, 30]);
g.keys.tolist(); // ['a', 'b']
g.groups.map(x => x.tolist()); // [[20], [10, 30]]
np.group_by([1, 0, 1], [1, 2, 3], {func: np.sum}).values.tolist(); // [2, 4]