UNPKG

1.19 kBTypeScriptView Raw
1/// <amd-module name="@tensorflow/tfjs-core/dist/ops/pow" />
2import { Tensor } from '../tensor';
3import { TensorLike } from '../types';
4/**
5 * Computes the power of one `tf.Tensor` to another. Supports broadcasting.
6 *
7 * Given a `tf.Tensor` x and a `tf.Tensor` y, this operation computes x^y for
8 * corresponding elements in x and y. The result's dtype will be the upcasted
9 * type of the `base` and `exp` dtypes.
10 *
11 * ```js
12 * const a = tf.tensor([[2, 3], [4, 5]])
13 * const b = tf.tensor([[1, 2], [3, 0]]).toInt();
14 *
15 * a.pow(b).print(); // or tf.pow(a, b)
16 * ```
17 *
18 * ```js
19 * const a = tf.tensor([[1, 2], [3, 4]])
20 * const b = tf.tensor(2).toInt();
21 *
22 * a.pow(b).print(); // or tf.pow(a, b)
23 * ```
24 * We also expose `powStrict` which has the same signature as this op and
25 * asserts that `base` and `exp` are the same shape (does not broadcast).
26 *
27 * @param base The base `tf.Tensor` to pow element-wise.
28 * @param exp The exponent `tf.Tensor` to pow element-wise.
29 *
30 * @doc {heading: 'Operations', subheading: 'Arithmetic'}
31 */
32declare function pow_<T extends Tensor>(base: Tensor | TensorLike, exp: Tensor | TensorLike): T;
33export declare const pow: typeof pow_;
34export {};