UNPKG

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