텐서플로우:: ops:: ExpandDims

#include <array_ops.h>

텐서의 형태에 1의 차원을 삽입합니다.

요약

텐서 input 주어지면, 이 연산은 input 의 shape의 차원 인덱스 axis 에 1을 삽입합니다. 차원 인덱스 axis 0부터 시작하며, axis 에 음수를 지정하면 끝에서부터 역순으로 계산됩니다.

이 연산은 단일 요소에 배치 차원을 추가하려는 경우 유용합니다. 예를 들어 [height, width, channels] 형태의 단일 이미지가 있는 경우 expand_dims(image, 0) 사용하여 1개의 이미지로 구성된 배치로 만들 수 있으며, 이렇게 하면 [1, height, width, channels] 형태가 됩니다.

다른 예시:

# 't' is a tensor of shape [2]
shape(expand_dims(t, 0)) ==> [1, 2]
shape(expand_dims(t, 1)) ==> [2, 1]
shape(expand_dims(t, -1)) ==> [2, 1]

# 't2' is a tensor of shape [2, 3, 5]
shape(expand_dims(t2, 0)) ==> [1, 2, 3, 5]
shape(expand_dims(t2, 2)) ==> [2, 3, 1, 5]
shape(expand_dims(t2, 3)) ==> [2, 3, 5, 1]

이 작업을 위해서는 다음이 필요합니다.

-1-input.dims() <= dim <= input.dims()

이 작업은 크기가 1인 차원을 제거하는 squeeze() 함수와 관련이 있습니다.

논거:

  • 범위: Scope 객체
  • 축: 0-D(스칼라). input 의 모양을 확장할 차원 인덱스를 지정합니다. [-rank(input) - 1, rank(input)] 범위 내에 있어야 합니다.

보고:

  • Output : input 과 동일한 데이터를 포함하지만, 크기가 1인 차원이 하나 더 추가됩니다.

생성자와 소멸자

ExpandDims (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input axis)

공개 속성

operation
output

공공 기능

node () const
::tensorflow::Node *
operator::tensorflow::Input () const
operator::tensorflow::Output () const

공개 속성

작업

Operation operation

산출

::tensorflow::Output output

공공 기능

크기 확장

 ExpandDims(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input,
  ::tensorflow::Input axis
)

마디

::tensorflow::Node * node() const 

연산자::텐서플로우::입력

 operator::tensorflow::Input() const 

연산자::텐서플로우::출력

 operator::tensorflow::Output() const