UNPKG

2.88 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2018 Google LLC. All Rights Reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 * =============================================================================
16 */
17/// <amd-module name="@tensorflow/tfjs-core/dist/ops/array_ops_util" />
18/**
19 * Gets the new shape of the input Tensor after it's been reshaped
20 * to:
21 * [blockShape[0], ..., blockShape[M-1], batch / prod(blockShape),
22 * inputShape[1], ..., inputShape[N-1]]
23 *
24 * See step 1: https://www.tensorflow.org/api_docs/python/tf/batch_to_space_nd
25 */
26export declare function getReshaped(inputShape: number[], blockShape: number[], prod: number, batchToSpace?: boolean): number[];
27/**
28 * Gets the permutation that will transpose the dimensions of the
29 * reshaped tensor to shape:
30 *
31 * [batch / prod(block_shape),inputShape[1], blockShape[0], ...,
32 * inputShape[M], blockShape[M-1],inputShape[M+1], ..., inputShape[N-1]]
33 *
34 * see step 2: https://www.tensorflow.org/api_docs/python/tf/batch_to_space_nd
35 */
36export declare function getPermuted(reshapedRank: number, blockShapeRank: number, batchToSpace?: boolean): number[];
37/**
38 * Gets the shape of the reshaped and permuted input Tensor before any cropping
39 * is applied. The new shape will be:
40 *
41 * [batch / prod(blockShape),inputShape[1] * blockShape[0], ...,
42 * inputShape[M] * blockShape[M-1],inputShape[M+1], ..., inputShape[N-1]]
43 *
44 * See step 3: https://www.tensorflow.org/api_docs/python/tf/batch_to_space_nd
45 */
46export declare function getReshapedPermuted(inputShape: number[], blockShape: number[], prod: number, batchToSpace?: boolean): number[];
47/**
48 * Converts the crops argument into the beginning coordinates of a slice
49 * operation.
50 */
51export declare function getSliceBeginCoords(crops: number[][], blockShape: number): number[];
52/**
53 * Converts the crops argument into the size of a slice operation. When
54 * combined with getSliceBeginCoords this function allows the reshaped and
55 * permuted Tensor to be cropped to its final output shape of:
56 *
57 * inputShape[1] * blockShape[0] - crops[0,0] - crops[0,1], ...,
58 * inputShape[M] * blockShape[M-1] -crops[M-1,0] -
59 * crops[M-1,1],inputShape[M+1], ..., inputShape[N-1]]
60 *
61 * See step 4: https://www.tensorflow.org/api_docs/python/tf/batch_to_space_nd
62 */
63export declare function getSliceSize(uncroppedShape: number[], crops: number[][], blockShape: number): number[];