W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
reverse_v2(
tensor,
axis,
name=None
)
參見指南:張量變換>分割和連接
反轉(zhuǎn)張量的特定維度.
需要注意的是tf.reverse現(xiàn)在已經(jīng)改變了為TF 1.0準(zhǔn)備的行為.tf.reverse_v2目前是一個別名,在TF 1.0之前將被棄用.
給定一個tensor和一個int32型張量axis,表示一組要反轉(zhuǎn)的tensor的維度.此操作反轉(zhuǎn)存在j
s.t. axis[j] == i
的每個維度i.
tensor最多可以有8個維度.axis指定的維數(shù)可以是0或更多的條目.如果指定的索引不止一次,則會引發(fā)InvalidArgument錯誤.
例如:
# tensor 't' is [[[[ 0, 1, 2, 3],
# [ 4, 5, 6, 7],
# [ 8, 9, 10, 11]],
# [[12, 13, 14, 15],
# [16, 17, 18, 19],
# [20, 21, 22, 23]]]]
# tensor 't' shape is [1, 2, 3, 4]
# 'dims' is [3] or 'dims' is -1
reverse(t, dims) ==> [[[[ 3, 2, 1, 0],
[ 7, 6, 5, 4],
[ 11, 10, 9, 8]],
[[15, 14, 13, 12],
[19, 18, 17, 16],
[23, 22, 21, 20]]]]
# 'dims' is '[1]' (or 'dims' is '[-3]')
reverse(t, dims) ==> [[[[12, 13, 14, 15],
[16, 17, 18, 19],
[20, 21, 22, 23]
[[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11]]]]
# 'dims' is '[2]' (or 'dims' is '[-2]')
reverse(t, dims) ==> [[[[8, 9, 10, 11],
[4, 5, 6, 7],
[0, 1, 2, 3]]
[[20, 21, 22, 23],
[16, 17, 18, 19],
[12, 13, 14, 15]]]]
參數(shù):
返回:
該函數(shù)將返回一個Tensor,它與tensor有相同的類型和形狀.
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: