2020-05-05 18:45:12 +00:00
|
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
|
// Licensed under the MIT License.
|
|
|
|
|
|
|
|
|
|
import {Tensor, TypedTensor} from './tensor';
|
|
|
|
|
|
|
|
|
|
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>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: add more tensor utilities
|
|
|
|
|
export interface TypedTensorUtils<T extends Tensor.Type> extends Properties, TypedShapeUtils<T> {}
|