Analysis
In addition to rendering, @torchjsorg/viz provides a suite of GPU-accelerated analysis tools to help you understand your data before it hits the screen.

Dimensionality Reduction
Visualizing high-dimensional embeddings requires compressing them into 2D or 3D space. Viz performs these operations directly on the GPU.
| Algorithm | Best For | Complexity |
|---|---|---|
| PCA | Fast, linear projections | Low |
| t-SNE | Revealing local clusters | High |
| UMAP | Preserving global structure | Medium |
import { createPCA } from '@torchjsorg/viz';
const pca = createPCA();
const lowerDim = await pca.fit_transform(highDimTensor, { n_components: 3 });Statistical Analysis
Quickly compute distributions and metrics across large tensors without stalling the main thread.
import { computeStats, computeHistogram } from '@torchjsorg/viz';
// Fast GPU-based statistics
const stats = await computeStats(myTensor);
console.log(stats.mean, stats.std, stats.median);
// Compute histogram bins on GPU
const histogram = await computeHistogram(myTensor, { bins: 100 });Next Steps
- Renderers - Draw the results of your analysis.
- torch.js Performance - Why GPU analysis is faster than CPU.