Esempio n. 1
0
    def visit(self, op, x):
        """
        TODO.

        Arguments:
          op: TODO

        Returns:
          TODO
        """
        if x.is_scalar and x.is_constant:
            val = power(x.const, op.reduction_axes.size)
            self.replace_op(op, constant(val))
Esempio n. 2
0
    def visit(self, op, x):
        """
        If x is filled with the same value, then replace the prod op
        with `power`.

        Arguments:
          op: TODO

        Returns:
          TODO
        """
        if x.is_scalar and x.is_constant:
            val = power(x.const, op.reduction_axes.size)
            self.replace_op(op, constant(val))