mindspore.nn.GraphKernel
- class mindspore.nn.GraphKernel(auto_prefix=True, flags=None)[source]
Base class for GraphKernel.
A GraphKernel a composite of basic primitives and can be compiled into a fused kernel automatically when enable_graph_kernel in context is set to True.
- Parameters
- Supported Platforms:
Ascend
GPU
Examples
>>> class Relu(nn.GraphKernel): ... def __init__(self): ... super(Relu, self).__init__() ... self.max = P.Maximum() ... ... def construct(self, x): ... return self.max(P.Fill()(P.DType()(x), P.Shape()(x), 0.0), x)