Array Operations

Array creation routines

chainerx.empty

Returns an array without initializing the elements.

chainerx.empty_like

Returns a new array with same shape and dtype of a given array.

chainerx.eye

Returns a 2-D array with ones on the diagonals and zeros elsewhere.

chainerx.identity

Returns a 2-D identity array.

chainerx.ones

Returns a new array of given shape and dtype, filled with ones.

chainerx.ones_like

Returns an array of ones with same shape and dtype as a given array.

chainerx.zeros

Returns a new array of given shape and dtype, filled with zeros.

chainerx.zeros_like

Returns an array of zeros with same shape and dtype as a given array.

chainerx.full

Returns a new array of given shape and dtype, filled with a given value.

chainerx.full_like

Returns a full array with same shape and dtype as a given array.

chainerx.array

Creates an array.

chainerx.asarray

Converts an object to an array.

chainerx.asanyarray

Converts an object to an array.

chainerx.ascontiguousarray

Returns a C-contiguous array.

chainerx.copy

Creates a copy of a given array.

chainerx.frombuffer

Returns a 1-D array interpretation of a buffer.

chainerx.fromfile

Constructs an array from data in a text or binary file.

chainerx.fromfunction

Constructs an array by executing a function over each coordinate.

chainerx.fromiter

Constructs a new 1-D array from an iterable object.

chainerx.fromstring

Constructs a new 1-D array initialized from text data in a string.

chainerx.loadtxt

Constructs an array by loading data from a text file.

chainerx.arange

Returns an array with evenly spaced values within a given interval.

chainerx.linspace

Returns an array with evenly spaced numbers over a specified interval.

chainerx.diag

Returns a diagonal or a diagonal array.

chainerx.diagflat

Creates a diagonal array from the flattened input.

chainerx.meshgrid

Returns coordinate matrices from coordinate vectors.

chainerx.tri

Returns a 2-D array with ones at and below the given diagonal and zeros elsewhere.

chainerx.tril

Lower triangle of an array.

chainerx.triu

Upper triangle of an array.

Activation functions

chainerx.log_softmax

The log of the softmax of input array.

chainerx.tanh

Element-wise hyperbolic tangent function.

chainerx.relu

Rectified Linear Unit function.

chainerx.sigmoid

Element-wise sigmoid logistic function.

chainerx.slstm

S-LSTM units as an activation function.

chainerx.tree_lstm

TreeLSTM unit as an activation function.

Array manipulation routines

chainerx.reshape

Returns a reshaped array.

chainerx.ravel

Returns a flattened array.

chainerx.transpose

Permutes the dimensions of an array.

chainerx.broadcast_to

Broadcasts an array to a given shape.

chainerx.squeeze

Removes size-one axes from the shape of an array.

chainerx.asarray

Converts an object to an array.

chainerx.ascontiguousarray

Returns a C-contiguous array.

chainerx.concatenate

Joins arrays along an axis.

chainerx.stack

Stacks arrays along a new axis.

chainerx.hstack

Stack arrays in sequence horizontally (column wise).

chainerx.vstack

Stack arrays in sequence vertically (row wise).

chainerx.dstack

Stack arrays in sequence depth wise (along third axis).

chainerx.atleast_2d

View inputs as arrays with at least two dimensions.

chainerx.atleast_3d

View inputs as arrays with at least three dimensions.

chainerx.split

Splits an array into multiple sub arrays along a given axis.

chainerx.dsplit

Split array into multiple sub-arrays along the 3rd axis (depth).

chainerx.vsplit

Splits an array into multiple sub-arrays vertically (row-wise).

chainerx.hsplit

Split an array into multiple sub-arrays horizontally (column-wise).

chainerx.swapaxes

Interchange two axes of an array.

chainerx.repeat

Constructs an array by repeating a given array.

chainerx.expand_dims

Expand the shape of an array.

chainerx.flip

Reverse the order of elements in an array along the given axis.

chainerx.fliplr

Flip array in the left/right direction.

chainerx.flipud

Flip array in the up/down direction.

chainerx.moveaxis

Move axes of an array to new positions.

Evaluation routines

chainerx.accuracy

Computes multiclass classification accuracy of the minibatch.

Indexing routines

chainerx.take

Takes elements from an array along an axis.

chainerx.where

Return elements chosen from x or y depending on condition.

chainerx.nonzero

Return the indices of the elements that are non-zero.

Linear algebra

chainerx.dot

Returns a dot product of two arrays.

chainerx.linalg.cholesky

Computes the Cholesky decomposition of a matrix.

chainerx.linalg.qr

Compute the qr factorization of a matrix.

chainerx.linalg.svd

Singular Value Decomposition.

chainerx.linalg.eigh

Compute the eigenvalues and eigenvectors of a real symmetric matrix.

chainerx.linalg.eigvalsh

Compute the eigenvalues of a real symmetric matrix.

chainerx.linalg.solve

Solves a linear matrix equation, or system of linear scalar equations.

chainerx.linalg.inv

Computes the inverse of a matrix.

chainerx.linalg.pinv

Compute the (Moore-Penrose) pseudo-inverse of a matrix.

Logic functions

chainerx.all

Test whether all array elements along a given axis evaluate to True.

chainerx.any

Test whether any array element along a given axis evaluate to True.

chainerx.isinf

Test element-wise for positive or negative infinity.

chainerx.isnan

Test element-wise for NaN and return result as a boolean array.

chainerx.logical_and

Returns an array of x1 AND x2 element-wise.

chainerx.logical_or

Returns an array of x1 OR x2 element-wise.

chainerx.logical_xor

Returns an array of x1 XOR x2 element-wise.

chainerx.logical_not

Returns an array of NOT x element-wise.

chainerx.greater

Returns an array of (x1 > x2) element-wise.

chainerx.greater_equal

Returns an array of (x1 >= x2) element-wise.

chainerx.less

Returns an array of (x1 < x2) element-wise.

chainerx.less_equal

Returns an array of (x1 <= x2) element-wise.

chainerx.equal

Returns an array of (x1 == x2) element-wise.

chainerx.not_equal

Returns an array of (x1 != x2) element-wise.

Loss functions

chainerx.absolute_error

Element-wise absolute error function.

chainerx.squared_error

Element-wise squared error function.

chainerx.huber_loss

Element-wise Huber loss.

chainerx.gaussian_kl_divergence

Element-wise KL-divergence of Gaussian variables from the standard one.

chainerx.sigmoid_cross_entropy

Element-wise cross entropy loss for pre-sigmoid activations.

Mathematical functions

chainerx.negative

Numerical negative, element-wise.

chainerx.add

Add arguments, element-wise.

chainerx.subtract

Subtract arguments, element-wise.

chainerx.multiply

Multiply arguments, element-wise.

chainerx.divide

Divide arguments, element-wise.

chainerx.mod

remainder(x1, x2) Return element-wise remainder of division.

chainerx.remainder

Return element-wise remainder of division.

chainerx.sum

Sum of array elements over a given axis.

chainerx.maximum

Maximum arguments, element-wise.

chainerx.minimum

Minimum arguments, element-wise.

chainerx.exp

Numerical exponential, element-wise.

chainerx.log

Natural logarithm, element-wise.

chainerx.log10

Base 10 logarithm, element-wise.

chainerx.log2

Base 2 logarithm, element-wise.

chainerx.log1p

Natural logarithm of one plus the input, element-wise.

chainerx.logsumexp

The log of the sum of exponentials of input array.

chainerx.log_softmax

The log of the softmax of input array.

chainerx.sqrt

Non-negative square-root, element-wise

chainerx.sin

Sine, element-wise

chainerx.cos

Cosine, element-wise

chainerx.tan

Tangent, element-wise

chainerx.arcsin

Inverse sine, element-wise

chainerx.arccos

Trigonometric inverse cosine, element-wise

chainerx.arctan

Trigonometric inverse tangent, element-wise

chainerx.arctan2

Element-wise arc tangent of \(\frac{x_1}{x_2}\) choosing the quadrant correctly.

chainerx.sinh

Hyperbolic Sine, element-wise

chainerx.cosh

Hyperbolic Cosine, element-wise

chainerx.tanh

Element-wise hyperbolic tangent function.

chainerx.arcsinh

Inverse hyperbolic sine, element-wise

chainerx.arccosh

Inverse hypberbolic inverse cosine, element-wise

chainerx.square

Returns the element-wise square of the input.

chainerx.clip

Clips the values of an array to a given interval.

chainerx.fabs

Compute the absolute values element-wise.

chainerx.sign

Returns an element-wise indication of the sign of a number.

chainerx.ceil

Return the ceiling of the input, element-wise..

chainerx.floor

Return the floor of the input, element-wise.

chainerx.bitwise_and

Compute the bit-wise AND of two arrays element-wise.

chainerx.bitwise_or

Compute the bit-wise OR of two arrays element-wise.

chainerx.bitwise_xor

Compute the bit-wise XOR of two arrays element-wise.

chainerx.left_shift

Shift the bits of an integer to the left.

chainerx.right_shift

Shift the bits of an integer to the right.

Random sampling

chainerx.random.normal

Draws random samples from a normal (Gaussian) distribution.

chainerx.random.uniform

Draws samples from a uniform distribution.

Sorting, searching, and counting

chainerx.argmax

Returns the indices of the maximum along an axis.

chainerx.argmin

Returns the indices of the minimum along an axis.

Statistics

chainerx.amax

Returns the maximum of an array or the maximum along an axis.

chainerx.mean

Compute the arithmetic mean along the specified axis.

chainerx.var

Compute the arithmetic var along the specified axis.

Connection

chainerx.conv

N-dimensional convolution.

chainerx.conv_transpose

N-dimensional transposed convolution.

chainerx.linear

Linear function, or affine transformation.

chainerx.lstm

Long Short-Term Memory units as an activation function.

Normalization

chainerx.batch_norm

Batch normalization function.

chainerx.fixed_batch_norm

Batch normalization function with fixed statistics.

Pooling

chainerx.max_pool

Spatial max pooling function.

chainerx.average_pool

Spatial average pooling function.

RNN

chainerx.n_step_lstm

Stacked Uni-directional Long Short-Term Memory function.

chainerx.n_step_bilstm

Stacked Bi-directional Long Short-Term Memory function.

chainerx.n_step_gru

Stacked Uni-directional Gated Recurrent Unit function.

chainerx.n_step_bigru

Stacked Bi-directional Gated Recurrent Unit function.

chainerx.n_step_rnn

Stacked Uni-directional RNN function for sequence inputs.

chainerx.n_step_birnn

Stacked Bi-directional RNN function for sequence inputs.