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

Method flatten

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

* Flattens input by reshaping it into a one-dimensional tensor. * If `start_dim` or `end_dim` are passed, only dimensions starting with `start_dim` * and ending with `end_dim` are flattened. The order of elements in input is unchanged. * @param {number} start_dim the first dim to flat

(start_dim = 0, end_dim = -1)

Source from the content-addressed store, hash-verified

659 * @returns {Tensor} The flattened tensor.
660 */
661 flatten(start_dim = 0, end_dim = -1) {
662 return this.clone().flatten_(start_dim, end_dim);
663 }
664
665 /**
666 * Returns a new tensor with the same data as the `self` tensor but of a different `shape`.

Calls 2

cloneMethod · 0.95
flatten_Method · 0.80

Tested by

no test coverage detected