MCPcopy
hub / github.com/huggingface/transformers.js / normalize

Method normalize

packages/transformers/src/utils/tensor.js:583–585  ·  view source on GitHub ↗

* Performs `L_p` normalization of inputs over specified dimension. * @param {number} [p=2] The exponent value in the norm formulation * @param {number} [dim=1] The dimension to reduce * @returns {Tensor} The normalized tensor.

(p = 2.0, dim = 1)

Source from the content-addressed store, hash-verified

581 * @returns {Tensor} The normalized tensor.
582 */
583 normalize(p = 2.0, dim = 1) {
584 return this.clone().normalize_(p, dim);
585 }
586
587 /**
588 * Compute and return the stride of this tensor.

Callers 2

_callMethod · 0.80
tensor.test.jsFile · 0.80

Calls 2

cloneMethod · 0.95
normalize_Method · 0.80

Tested by

no test coverage detected