OwlCyberSecurity - MANAGER
Edit File: shape_base.cpython-38.pyc
U �p�]�p � @ s� d dl mZmZmZ dddddddgZd d lZd d lZd d lZd dlm Z d dlmZ d d l mZm Z mZ d dlmZ ejejdd�Zdd� Zee�dd� �Zdd� Zee�dd� �Zdd� Zee�dd� �Zd<dd�Zdd� Zee�dd� �Zee�d d� �Zd=d!d"�Zee�d>d#d��Zee j d$e j �Z!ee j"d$e j"�Z#ee j$d$e j$�Z%d%d&� Z&g fd'd(�Z'd)d*� Z(d+d,� Z)d-d.� Z*d?d/d0�Z+d@d1d2�Z,d3d4� Z-ee-�d5d� �Z.d6d7� Z/d8d9� Z0d:d;� Z1d S )A� )�division�absolute_import�print_function� atleast_1d� atleast_2d� atleast_3d�block�hstack�stack�vstackN� )�numeric)� overrides)�array� asanyarray�newaxis)�normalize_axis_indexZnumpy)�modulec G s | S �N� ��arysr r �7/usr/lib/python3/dist-packages/numpy/core/shape_base.py�_atleast_1d_dispatcher s r c G sV g }| D ]0}t |�}|jdkr*|�d�}n|}|�|� qt|�dkrN|d S |S dS )a Convert inputs to arrays with at least one dimension. Scalar inputs are converted to 1-dimensional arrays, whilst higher-dimensional inputs are preserved. Parameters ---------- arys1, arys2, ... : array_like One or more input arrays. Returns ------- ret : ndarray An array, or list of arrays, each with ``a.ndim >= 1``. Copies are made only if necessary. See Also -------- atleast_2d, atleast_3d Examples -------- >>> np.atleast_1d(1.0) array([1.]) >>> x = np.arange(9.0).reshape(3,3) >>> np.atleast_1d(x) array([[0., 1., 2.], [3., 4., 5.], [6., 7., 8.]]) >>> np.atleast_1d(x) is x True >>> np.atleast_1d(1, [3, 4]) [array([1]), array([3, 4])] r r N)r �ndim�reshape�append�len�r �resZary�resultr r r r s ( c G s | S r r r r r r �_atleast_2d_dispatcherN s r! c G st g }| D ]N}t |�}|jdkr,|�dd�}n |jdkrH|tdd�f }n|}|�|� qt|�dkrl|d S |S dS )a\ View inputs as arrays with at least two dimensions. Parameters ---------- arys1, arys2, ... : array_like One or more array-like sequences. Non-array inputs are converted to arrays. Arrays that already have two or more dimensions are preserved. Returns ------- res, res2, ... : ndarray An array, or list of arrays, each with ``a.ndim >= 2``. Copies are avoided where possible, and views with two or more dimensions are returned. See Also -------- atleast_1d, atleast_3d Examples -------- >>> np.atleast_2d(3.0) array([[3.]]) >>> x = np.arange(3.0) >>> np.atleast_2d(x) array([[0., 1., 2.]]) >>> np.atleast_2d(x).base is x True >>> np.atleast_2d(1, [1, 2], [[1, 2]]) [array([[1]]), array([[1, 2]]), array([[1, 2]])] r r N�r r r r r r r r r r r R s & c G s | S r r r r r r �_atleast_3d_dispatcher� s r# c G s� g }| D ]t}t |�}|jdkr.|�ddd�}nD|jdkrL|tdd�tf }n&|jdkrn|dd�dd�tf }n|}|�|� qt|�dkr�|d S |S dS )a View inputs as arrays with at least three dimensions. Parameters ---------- arys1, arys2, ... : array_like One or more array-like sequences. Non-array inputs are converted to arrays. Arrays that already have three or more dimensions are preserved. Returns ------- res1, res2, ... : ndarray An array, or list of arrays, each with ``a.ndim >= 3``. Copies are avoided where possible, and views with three or more dimensions are returned. For example, a 1-D array of shape ``(N,)`` becomes a view of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a view of shape ``(M, N, 1)``. See Also -------- atleast_1d, atleast_2d Examples -------- >>> np.atleast_3d(3.0) array([[[3.]]]) >>> x = np.arange(3.0) >>> np.atleast_3d(x).shape (1, 3, 1) >>> x = np.arange(12.0).reshape(4,3) >>> np.atleast_3d(x).shape (4, 3, 1) >>> np.atleast_3d(x).base is x.base # x is a reshape, so not base itself True >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): ... print(arr, arr.shape) # doctest: +SKIP ... [[[1] [2]]] (1, 2, 1) [[[1] [2]]] (1, 2, 1) [[[1 2]]] (1, 1, 2) r r N� r"