UNPKG

@tensorflow/tfjs-core

Version:

Hardware-accelerated JavaScript library for machine intelligence

35 lines (34 loc) 1.62 kB
/** * @license * Copyright 2020 Google Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ import { Tensor } from '../tensor'; import { Rank, ShapeMap, TensorLike } from '../types'; /** * Broadcast an array to a compatible shape NumPy-style. * * The tensor's shape is compared to the broadcast shape from end to beginning. * Ones are prepended to the tensor's shape until is has the same length as * the broadcast shape. If input.shape[i]==shape[i], the (i+1)-th axis is * already broadcast-compatible. If input.shape[i]==1 and shape[i]==N, then * the input tensor is tiled N times along that axis (using tf.tile). * * @param input The tensor that is to be broadcasted. * @param shape The input is to be broadcast to this shape. */ /** @doc {heading: 'Tensors', subheading: 'Transformations'} */ declare function broadcastTo_<R extends Rank>(x: Tensor | TensorLike, shape: ShapeMap[R]): Tensor<R>; export declare const broadcastTo: typeof broadcastTo_; export {};