본문 바로가기

IT/TensorFlow

[Tensorflow] tf.tile

1. tf.tile

tf.tile은 Tensorflow Document에 나와있습니다.

tile(
    input,
    multiples,
    name=None
)


tf.tile은 tensorflow/python/ops/gen_array_ops.py에 정의되어있습니다.

해당 스크립트는 설치된 패키지에서 찾아야합니다. Tensorflow github 저장소에는 없습니다.


설명은 다음과 같습니다.


Constructs a tensor by tiling a given tensor.

This operation creates a new tensor by replicating input multiples times. The output tensor's i'th dimension has input.dims(i) * multiples[i] elements, and the values of input are replicated multiples[i] times along the 'i'th dimension. For example, tiling [a b c d] by [2] produces [a b c d a b c d].


주어진 Tensor를 타일링합니다.

해당 연산은 입력을 여러번 복제하는 것을 통해서 새로운 tensor를 만듭니다. 출력 tensor의 차원은 입력의 차원 x multiples[i] 요소입니다. 

만약에 tf.tile([a,b,c,d], [2])라는 형태로 파라미터를 주었다면, 결과값으로 [a,b,c,d,a,b,c,d]의 텐서를 얻을 수 있습니다.


파라미터


Input : 1-D이거나 그보다 높은 텐서입니다.

multiples : dtype이 int32, int64이어야하는 텐서입니다. 길이는 입력의 차원과 같아야합니다.

name : 해당 연산의 이름입니다.



Return:

입력과 같은 dtype을 갖는 텐서입니다.