tf.invert_permutation(x,name=None)计算序列的逆置换(inverse permutation)。本操作是计算张量的索引的逆置换。x是一维的整数张量,表示一个以0为开始的索引数组,然后根据这里元素的值来放入整数什,计算公式如下:y[x[i]] = i for i in [0, 1, ..., len(x) -1]从0开始,没有重复和负数值。例如:# 张量 `x` 是 [3, 4, 0, 2, 1]invert_permutation(x) ==> [2, 4, 3, 0, 1]参数:· x: 张量,必须是下面类型之一: int32, int64。 1-D。· name: 操作的名称,可选。返回值:张量,与x类型相同。1-D。#python 3.5.3/TensorFlow 1.0.1/win 10
#2017-04-26 蔡军生 http://blog.csdn.net/caimouse
#
#导入要使用的库
import tensorflow as tf
import numpy as np
#演示API的类
class DemoTF:
def __init__(self):
'''构造函数'''
self.num1 = tf.Variable([1, 2, 0,
...
继续阅读
(80)