Table Of Contents

Previous topic

tensor.extra_ops – Tensor Extra Ops

Next topic

tensor.slinalg – Linear Algebra Ops Using Scipy

This Page

tensor.io – Tensor IO Ops

File operation

MPI operation

Details

class theano.tensor.io.LoadFromDisk(dtype, broadcastable, mmap_mode=None)

An operation to load an array from disk

See Also
load

@note: Non-differentiable.

class theano.tensor.io.MPIRecv(source, tag, shape, dtype)

An operation to asynchronously receive an array to a remote host using MPI

See Also
MPIRecv MPIWait

@note: Non-differentiable.

class theano.tensor.io.MPIRecvWait(tag)

An operation to wait on a previously received array using MPI

See Also
MPIRecv

@note: Non-differentiable.

class theano.tensor.io.MPISend(dest, tag)

An operation to asynchronously Send an array to a remote host using MPI

See Also
MPIRecv MPISendWait

@note: Non-differentiable.

class theano.tensor.io.MPISendWait(tag)

An operation to wait on a previously sent array using MPI

See Also:
MPISend

@note: Non-differentiable.

theano.tensor.io.irecv(shape, dtype, source, tag)

non-blocking receive

theano.tensor.io.isend(var, dest, tag)

Non blocking send

theano.tensor.io.load(path, dtype, broadcastable, mmap_mode=None)

Load an array from an .npy file.

Parameters:
  • path – A Generic symbolic variable, that will contain a string
  • dtype – The data type of the array to be read.
  • broadcastable – The broadcastable pattern of the loaded array, for instance, (False,) for a vector, (False, True) for a column, (False, False) for a matrix.
  • mmap_mode – How the file will be loaded. None means that the data will be copied into an array in memory, ‘c’ means that the file will be mapped into virtual memory, so only the parts that are needed will be actually read from disk and put into memory. Other modes supported by numpy.load (‘r’, ‘r+’, ‘w+’) cannot be supported by Theano.
>>> from theano import *
>>> path = Variable(Generic())
>>> x = tensor.load(path, 'int64', (False,))
>>> y = x*2
>>> fn = function([path], y)
>>> fn("stored-array.npy")
array([0, 2, 4, 6, 8], dtype=int64)
theano.tensor.io.mpi_send_wait_key(a)

Wait as long as possible on Waits, Start Send/Recvs early

theano.tensor.io.mpi_tag_key(a)

Break MPI ties by using the variable tag - prefer lower tags first

theano.tensor.io.recv(shape, dtype, source, tag)

blocking receive

theano.tensor.io.send(var, dest, tag)

blocking send