텐서플로우:: 작전:: ExpandDims

#include <array_ops.h>

텐서의 모양에 1차원을 삽입합니다.

요약

텐서 input 주어지면 이 작업은 input 모양의 차원 인덱스 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() 와 관련이 있습니다.

인수:

  • 범위: 범위 개체
  • 축: 0차원(스칼라). 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

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

마디

::tensorflow::Node * node() const 

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

 operator::tensorflow::Input() const 

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

 operator::tensorflow::Output() const