Compute softmax using CuDNN Parameters ---------- x : tvm.te.Tensor The input tensor axis : int The axis to compute the softmax Returns ------- ret : tvm.te.Tensor The result tensor
(x, axis=-1)
| 875 | |
| 876 | |
| 877 | def softmax(x, axis=-1): |
| 878 | """Compute softmax using CuDNN |
| 879 | |
| 880 | Parameters |
| 881 | ---------- |
| 882 | x : tvm.te.Tensor |
| 883 | The input tensor |
| 884 | |
| 885 | axis : int |
| 886 | The axis to compute the softmax |
| 887 | |
| 888 | Returns |
| 889 | ------- |
| 890 | ret : tvm.te.Tensor |
| 891 | The result tensor |
| 892 | """ |
| 893 | return te.extern( |
| 894 | x.shape, |
| 895 | [x], |
| 896 | lambda ins, outs: tvm.tirx.call_packed( |
| 897 | "tvm.contrib.cudnn.softmax.forward", ins[0], outs[0], axis |
| 898 | ), |
| 899 | name="y", |
| 900 | ) |
| 901 | |
| 902 | |
| 903 | def log_softmax(x, axis=-1): |
nothing calls this directly
no test coverage detected
searching dependent graphs…