Esempio n. 1
0
File: Type.py Progetto: shas19/EzPC
    def visitTranspose(self, node: AST.Transpose, args=None):
        node.expr.gamma = dict(node.gamma)
        exprType = self.visit(node.expr)

        assert isTensor(exprType)

        perm = node.perm
        shape = exprType.shape
        new_shape = []
        for i in perm:
            new_shape.append(shape[i])
        node.type = Tensor(new_shape)
        return node.type
Esempio n. 2
0
    def visitTranspose(self, node: AST.Transpose, args=None):
        node.expr.gamma = dict(node.gamma)
        exprType = self.visit(node.expr)

        assert isTensor(exprType)

        perm = node.perm
        shape = exprType.shape
        if (perm is None):
            perm = [i for i in reversed(range(len(shape)))]
        new_shape = []
        for i in perm:
            new_shape.append(shape[i])
        node.type = Tensor(new_shape, exprType.bitlen, exprType.isSecret,
                           exprType.taint)
        return node.type