Skip to main content
Home

Built and signed on GitHub Actions

A simple neural network library for JavaScript and TypeScript.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
2 months ago (1.0.0)
method Tensor.prototype.multiply
Tensor.prototype.multiply(other: Tensor): Tensor

Performs matrix multiplication with another tensor. The number of columns in the first tensor must match the number of rows in the second tensor.

Examples

Example 1

const a = new Tensor([[1, 2], [3, 4]]); // 2x2
const b = new Tensor([[5, 6], [7, 8]]); // 2x2
const product = a.multiply(b); // Result: [[19, 22], [43, 50]]

const c = new Tensor([[1, 2, 3], [4, 5, 6]]); // 2x3
const d = new Tensor([[7, 8], [9, 10], [11, 12]]); // 3x2
const productCD = c.multiply(d); // Result: [[58, 64], [139, 154]]

Parameters

other: Tensor

The tensor to multiply with the current tensor.

Return Type

A new Tensor representing the result of the multiplication.

Throws

Error if the inner dimensions do not match for multiplication.

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@am/neuralnetwork

Import symbol

import { Tensor } from "@am/neuralnetwork";
or

Import directly with a jsr specifier

import { Tensor } from "jsr:@am/neuralnetwork";

Add Package

pnpm i jsr:@am/neuralnetwork
or (using pnpm 10.8 or older)
pnpm dlx jsr add @am/neuralnetwork

Import symbol

import { Tensor } from "@am/neuralnetwork";

Add Package

yarn add jsr:@am/neuralnetwork
or (using Yarn 4.8 or older)
yarn dlx jsr add @am/neuralnetwork

Import symbol

import { Tensor } from "@am/neuralnetwork";

Add Package

vlt install jsr:@am/neuralnetwork

Import symbol

import { Tensor } from "@am/neuralnetwork";

Add Package

npx jsr add @am/neuralnetwork

Import symbol

import { Tensor } from "@am/neuralnetwork";

Add Package

bunx jsr add @am/neuralnetwork

Import symbol

import { Tensor } from "@am/neuralnetwork";