Пример #1
0
    def __init__(self, name: Optional[str], M: Union[int, Placeholder],
                 N: Union[int, Placeholder], K: Union[int, Placeholder],
                 out_shape: Sequence[Union[int, Placeholder]],
                 out_order: Order, transpose_A: bool, transpose_B: bool):
        super().__init__(name)

        assert len(out_shape) == out_order.ndim
        if Placeholder.check_resolved(
                mul(out_shape)) and Placeholder.check_resolved(M * N):
            assert mul(out_shape) == M * N

        self.parameters["M"] = M
        self.parameters["N"] = N
        self.parameters["K"] = K
        self.parameters["out_shape"] = out_shape
        self.parameters["out_order"] = out_order
        self.parameters["transpose_A"] = transpose_A
        self.parameters["transpose_B"] = transpose_B
        self.attributes.add(Associative(self, ('A', 'B')))
Пример #2
0
 def __init__(self, name: Optional[str]):
     super(ElementwiseMul, self).__init__(name)
     self.attributes.add(Commutative(self, ('x0', 'x1')))
     self.attributes.add(Associative(self, ('x0', 'x1')))