2020-05-05 18:45:12 +00:00
|
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
|
// Licensed under the MIT License.
|
|
|
|
|
|
2023-06-12 19:05:11 +00:00
|
|
|
import {ConversionUtils} from './tensor-conversion.js';
|
|
|
|
|
import {Tensor, TypedTensor} from './tensor.js';
|
2020-05-05 18:45:12 +00:00
|
|
|
|
|
|
|
|
interface Properties {
|
|
|
|
|
/**
|
|
|
|
|
* Get the number of elements in the tensor.
|
|
|
|
|
*/
|
|
|
|
|
readonly size: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TypedShapeUtils<T extends Tensor.Type> {
|
|
|
|
|
/**
|
|
|
|
|
* Create a new tensor with the same data buffer and specified dims.
|
|
|
|
|
*
|
2021-05-02 05:20:22 +00:00
|
|
|
* @param dims - New dimensions. Size should match the old one.
|
2020-05-05 18:45:12 +00:00
|
|
|
*/
|
|
|
|
|
reshape(dims: readonly number[]): TypedTensor<T>;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-09 23:19:29 +00:00
|
|
|
/**
|
|
|
|
|
* interface `TensorUtils` includes all utility members that does not use the type parameter from their signature.
|
|
|
|
|
*/
|
|
|
|
|
export interface TensorUtils extends Properties, ConversionUtils {}
|
2023-05-01 16:37:50 +00:00
|
|
|
|
2023-06-09 23:19:29 +00:00
|
|
|
/**
|
|
|
|
|
* interface `TypedShapeUtils` includes all utility members that uses the type parameter from their signature.
|
|
|
|
|
*/
|
|
|
|
|
export interface TypedTensorUtils<T extends Tensor.Type> extends TensorUtils, TypedShapeUtils<T> {}
|