UNPKG

580 BTypeScriptView Raw
1/// <amd-module name="@tensorflow/tfjs-core/dist/ops/cast" />
2import { Tensor } from '../tensor';
3import { DataType, TensorLike } from '../types';
4/**
5 * Casts a `tf.Tensor` to a new dtype.
6 *
7 * ```js
8 * const x = tf.tensor1d([1.5, 2.5, 3]);
9 * tf.cast(x, 'int32').print();
10 * ```
11 * @param x The input tensor to be casted.
12 * @param dtype The dtype to cast the input tensor to.
13 *
14 * @doc {heading: 'Tensors', subheading: 'Transformations'}
15 */
16declare function cast_<T extends Tensor>(x: T | TensorLike, dtype: DataType): T;
17export declare const cast: typeof cast_;
18export {};