neural_tangents/stax.py
def new_kernel_fn(x1_or_kernel, x2=None, get=None, marginalization='auto'):
    """Returns the `Kernel` resulting from applying `ker_fun` to given inputs.

    Args:
      x1_or_kernel: either a `np.ndarray` with shape
        `[batch_size_1] + input_shape`, or a `Kernel`.
      x2: an optional `np.ndarray` with shape `[batch_size_2] + input_shape`.
        `None` means `x2 == x1` or `x1_or_kernel is Kernel`.
      get: either `None`, a string, or a tuple of strings specifying which data
        should be returned by the kernel function. Can be "nngp", "ntk", "var1",
        "var2", "is_gaussian", "is_height_width", "marginal", "cross".
      marginalization: Either a string with value "auto" or "none" or a dict.
        If "auto" then stax attempts to automatically identify which
        dimensions are most appropriate to marginalize over. If "none" then no
        marginalization is performed. If a dict then the user can manually
        specify the marginalization for the self- and cross- correlations.
    Returns:
      If `get` is a string, returns the requested `np.ndarray`. If `get` is a
      tuple, returns an `AnalyticKernel` namedtuple containing only the
      requested information. If `get` is None then a Kernel object is returned
      containing all the data.
    """

    if (isinstance(x1_or_kernel, Kernel) or
        (isinstance(x1_or_kernel, list) and
         all(isinstance(k, Kernel) for k in x1_or_kernel))):
      _check_marginalization(kernel_fn, x1_or_kernel)
      return _apply_kernel(init_fn, kernel_fn, x1_or_kernel)
    return outer_kernel_fn(x1_or_kernel, x2, get, marginalization)
Returns the `Kernel` resulting from applying `ker_fun` to given inputs.

    Args:
      x1_or_kernel: either a `np.ndarray` with shape
        `[batch_size_1] + input_shape`, or a `Kernel`.
      x2: an optional `np.ndarray` with shape `[batch_size_2] + input_shape`.
        `None` means `x2 == x1` or `x1_or_kernel is Kernel`.
      get: either `None`, a string, or a tuple of strings specifying which data
        should be returned by the kernel function. Can be "nngp", "ntk", "var1",
        "var2", "is_gaussian", "is_height_width", "marginal", "cross".
      marginalization: Either a string with value "auto" or "none" or a dict.
        If "auto" then stax attempts to automatically identify which
        dimensions are most appropriate to marginalize over. If "none" then no
        marginalization is performed. If a dict then the user can manually
        specify the marginalization for the self- and cross- correlations.
    Returns:
      If `get` is a string, returns the requested `np.ndarray`. If `get` is a
      tuple, returns an `AnalyticKernel` namedtuple containing only the
      requested information. If `get` is None then a Kernel object is returned
      containing all the data.
    
Returns the `Kernel` resulting from applying `ker_fun` to given inputs.
Returns the ` Kernel ` resulting from applying ` ker_fun ` to given inputs .
def new_kernel_fn(x1_or_kernel, x2=None, get=None, marginalization='auto'):
    if (isinstance(x1_or_kernel, Kernel) or
        (isinstance(x1_or_kernel, list) and
         all(isinstance(k, Kernel) for k in x1_or_kernel))):
      _check_marginalization(kernel_fn, x1_or_kernel)
      return _apply_kernel(init_fn, kernel_fn, x1_or_kernel)
    return outer_kernel_fn(x1_or_kernel, x2, get, marginalization)
def new_kernel_fn ( x1_or_kernel , x2 = None , get = None , marginalization = 'auto' ) : if ( isinstance ( x1_or_kernel , Kernel ) or ( isinstance ( x1_or_kernel , list ) and all ( isinstance ( k , Kernel ) for k in x1_or_kernel ) ) ) : _check_marginalization ( kernel_fn , x1_or_kernel ) return _apply_kernel ( init_fn , kernel_fn , x1_or_kernel ) return outer_kernel_fn ( x1_or_kernel , x2 , get , marginalization )
Returns the `Kernel` resulting from applying `ker_fun` to given inputs.
Returns the ` Kernel ` resulting from applying ` ker_fun ` to given inputs .
"""Returns the `Kernel` resulting from applying `ker_fun` to given inputs.

    Args:
      x1_or_kernel: either a `np.ndarray` with shape
        `[batch_size_1] + input_shape`, or a `Kernel`.
      x2: an optional `np.ndarray` with shape `[batch_size_2] + input_shape`.
        `None` means `x2 == x1` or `x1_or_kernel is Kernel`.
      get: either `None`, a string, or a tuple of strings specifying which data
        should be returned by the kernel function. Can be "nngp", "ntk", "var1",
        "var2", "is_gaussian", "is_height_width", "marginal", "cross".
      marginalization: Either a string with value "auto" or "none" or a dict.
        If "auto" then stax attempts to automatically identify which
        dimensions are most appropriate to marginalize over. If "none" then no
        marginalization is performed. If a dict then the user can manually
        specify the marginalization for the self- and cross- correlations.
    Returns:
      If `get` is a string, returns the requested `np.ndarray`. If `get` is a
      tuple, returns an `AnalyticKernel` namedtuple containing only the
      requested information. If `get` is None then a Kernel object is returned
      containing all the data.
    """
If `get` is a string, returns the requested `np.ndarray`. If `get` is a
tuple, returns an `AnalyticKernel` namedtuple containing only the
requested information. If `get` is None then a Kernel object is returned
containing all the data.
If ` get ` is a string returns the requested ` np . ndarray ` . If ` get ` is a tuple returns an ` AnalyticKernel ` namedtuple containing only the requested information . If ` get ` is None then a Kernel object is returned containing all the data .
x1_or_kernel
either a `np.ndarray` with shape
`[batch_size_1] + input_shape`, or a `Kernel`.
either a ` np . ndarray ` with shape ` [ batch_size_1 ] + input_shape ` or a ` Kernel ` .
x2
an optional `np.ndarray` with shape `[batch_size_2] + input_shape`.
`None` means `x2 == x1` or `x1_or_kernel is Kernel`.
an optional ` np . ndarray ` with shape ` [ batch_size_2 ] + input_shape ` . ` None ` means ` x2 == x1 ` or ` x1_or_kernel is Kernel ` .
get
either `None`, a string, or a tuple of strings specifying which data
should be returned by the kernel function. Can be "nngp", "ntk", "var1",
"var2", "is_gaussian", "is_height_width", "marginal", "cross".
either ` None ` a string or a tuple of strings specifying which data should be returned by the kernel function . Can be " nngp " " ntk " " var1 " " var2 " " is_gaussian " " is_height_width " " marginal " " cross " .
marginalization
Either a string with value "auto" or "none" or a dict.
If "auto" then stax attempts to automatically identify which
dimensions are most appropriate to marginalize over. If "none" then no
marginalization is performed. If a dict then the user can manually
specify the marginalization for the self- and cross- correlations.
Either a string with value " auto " or " none " or a dict . If " auto " then stax attempts to automatically identify which dimensions are most appropriate to marginalize over . If " none " then no marginalization is performed . If a dict then the user can manually specify the marginalization for the self - and cross - correlations .