{"push_id":3844465655,"size":1,"distinct_size":1,"ref":"refs/heads/relay-reinterpret-op","head":"f0470d89f58e1d69b7cfdccb2f1d60c5f634a096","before":"e3c8c02023fc44fbcbbb59a7595820d13f3e6fe9","commits":[{"sha":"f0470d89f58e1d69b7cfdccb2f1d60c5f634a096","author":{"name":"Andrew Tulloch","email":"02e0a999c50b1f88df7a8f5a04e1b76b35ea6a88@tullo.ch"},"message":"{relay,topi}.reinterpret support\n\n= Motivation\n\nIt's useful to expose the tvm::reinterpret functionality to Relay/TOPI users, as\nthis allows them to build (fused) operators leveraging the bitwise\nreinterpretation of an operator. An example is approximate transcendental\nfunctions, which can be implemented similar to:\n\n```.py\n    def C(x):\n        return relay.expr.const(x, \"float32\")\n\n    def approx_exp(x):\n        x = relay.minimum(relay.maximum(x, C(-88.0)), C(88.0))\n        x = C(127.0) + x * C(1.44269504)\n        xf = relay.floor(x)\n        i = relay.cast(xf, \"int32\")\n        x = x - xf\n        Y = C(0.99992522) + x * (C(0.69583354) + x * (C(0.22606716) + x * C(0.078024523)))\n        exponent = relay.left_shift(i, relay.expr.const(23, \"int32\"))\n        exponent = relay.reinterpret(exponent, \"float32\")\n        return exponent * Y\n\n    def approx_sigmoid(x):\n        # <2.0e-5 absolute error over [-5, 5]\n        y = approx_exp(x)\n        return y / (y + C(1.0))\n\n    def approx_tanh(x):\n        # <4.0e-5 absolute error over [-5, 5]\n        x = x * C(2.0)\n        y = approx_exp(x)\n        return (y - C(1.0)) / (y + C(1.0))\n```\n\nSee unit tests for implementations of these approximate transendentals.","distinct":true,"url":"https://api.github.com/repos/ajtulloch/tvm/commits/f0470d89f58e1d69b7cfdccb2f1d60c5f634a096"}]}
{"actor":{"display_login":"ajtulloch"}}