keras_array: Keras array object

View source: R/utils.R

keras_arrayR Documentation

Keras array object

Description

Convert an R vector, matrix, or array object to an array that has the optimal in-memory layout and floating point data type for the current Keras backend.

Usage

keras_array(x, dtype = NULL)

Arguments

x

Object or list of objects to convert

dtype

NumPy data type (e.g. float32, float64). If this is unspecified then R doubles will be converted to the default floating point type for the current Keras backend.

Details

Keras does frequent row-oriented access to arrays (for shuffling and drawing batches) so the order of arrays created by this function is always row-oriented ("C" as opposed to "Fortran" ordering, which is the default for R arrays).

If the passed array is already a NumPy array with the desired dtype and "C" order then it is returned unmodified (no additional copies are made).

Value

NumPy array with the specified dtype (or list of NumPy arrays if a list was passed for x).


keras documentation built on May 29, 2024, 3:20 a.m.