Пример #1
0
def build_to_func(inputs, args, shape_params=None, name="default_function",
                  binds=None, attrs=None, polyhedral=False, target="cce"):
    """Build module."""
    tmp_binds = None
    if binds is not None:
        tmp_binds = None if not bool(binds) else binds
    tmp_attrs = None
    if attrs is not None:
        tmp_attrs = None if not bool(attrs) else attrs
    for arg in args:
        vc_util.tensor_max_size_check(arg)
    if shape_params is None:
        shape_params = []
    cfg = _api_internal._GetCurrentBuildConfig()
    return _api_internal._BuildToFunc(inputs, args, shape_params, name, tmp_binds, tmp_attrs,
                                      polyhedral, target, cfg)
Пример #2
0
def softsign(data):
    """
    Computes for softsign.

    .. math::
        y = \\frac{x}{\\left|x\\right| + 1}

    Args:
        data (tvm.tensor.Tensor): Tensor of type float16 or float32.

    Returns:
        tvm.tensor.Tensor with same shape and dtype as inputs.
    """
    vc_util.check_shape(data.shape)
    vc_util.tensor_max_size_check(data)
    vc_util.ops_dtype_check(data.dtype, vc_util.DtypeForDavinci.ALL_FLOAT)

    return softsign_compute(data)