Skip to main content
torch.jstorch.jstorch.js
Getting StartedPlaygroundContact
Login
torch.jstorch.jstorch.js
Documentation
IntroductionType SafetyTensor IndexingEinsumEinopsAutogradTraining a ModelProfiling & MemoryPyTorch MigrationBest PracticesRuntimesPerformance
IntroductionRenderersAnalysis
torch.js· 2026
LegalTerms of UsePrivacy Policy
  1. docs
  2. Viz
  3. Analysis

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.

Visualization of high-dimensional data being compressed into 2D

Dimensionality Reduction

Visualizing high-dimensional embeddings requires compressing them into 2D or 3D space. Viz performs these operations directly on the GPU.

AlgorithmBest ForComplexity
PCAFast, linear projectionsLow
t-SNERevealing local clustersHigh
UMAPPreserving global structureMedium
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.
Previous
Renderers
Next
computeCorrelation