BatchNorm
#
import set_env
from tvm.relay.frontend.onnx import BatchNorm
BatchNorm??
Init signature: BatchNorm()
Source:
class BatchNorm(OnnxOpConverter):
"""Operator converter for BatchNorm."""
@classmethod
def _impl_v1(cls, inputs, attr, params):
# TODO(zhreshold): 'spatial' is not properly handled here.
# TODO(vvchernov): 'training_mode' (onnx tag) is not correctly handled, ignore for now
out = AttrCvt(
op_name="batch_norm",
ignores=["spatial", "is_test", "consumed_inputs", "momentum", "training_mode"],
)(inputs, attr, params)
# We only support test mode, so we return data, moving_mean, moving_var,
# and then moving_mean and moving_var again as placeholders for
# the expected "saved_mean", "saved_var".
return _expr.TupleWrapper(_expr.Tuple((*out, out[1], out[2])), 5)
File: /media/pc/data/lxw/ai/tvm/python/tvm/relay/frontend/onnx.py
Type: type
Subclasses:
from tvm.relay import expr as _expr
_expr.TupleWrapper?
Init signature: _expr.TupleWrapper(tuple_value, size)
Docstring:
TupleWrapper.
This class is a Python wrapper for a Relay tuple of known size.
It allows for accessing the fields of the Relay tuple as though
it were a Python tuple.
Parameters
----------
tuple_value: tvm.relay.Expr
The input tuple
size: int
The size of the tuple.
File: /media/pc/data/lxw/ai/tvm/python/tvm/relay/expr.py
Type: type
Subclasses:
from tvm.relay.frontend.common import AttrCvt
out = AttrCvt(
op_name="batch_norm",
ignores=["spatial", "is_test", "consumed_inputs", "momentum", "training_mode"],
)