theano.gpuarray.type – Type classes

  • class theano.gpuarray.type.GpuArrayConstant(type, data, name=None)[source]
  • A constant representing a value on a certain GPU.

This supports all the operations that TensorTypesupports.

See also

Constant

  • class theano.gpuarray.type.GpuArraySharedVariable(name, type, value, strict, allow_downcast=None, container=None)[source]
  • A variable representing a shared value on a certain GPU.

This supports all the operations that TensorTypesupports.

See also

SharedVariable

  • class theano.gpuarray.type.GpuArrayType(dtype, broadcastable, context_name=None, name=None)[source]
  • The type that represents an array on a gpu.

The dtype indicates what scalar data type the elements ofvariables of this type will be.

broadcastable indicates whether each dimension is broadcastableor not (to be broadcastable a dimension must always be of length1).

The context_name is the name of the context on will values ofvariables of this type will be stored.

Parameters:

  • dtype (str) – The name of a numpy dtype
  • broadcastable (tuple of bools) – A tuple that indicates both the number of dimensions (by itslength) and whether those dimensions are broadcastable or not(by the boolean values).
  • context_name (str) – The name of the context the that this type is attached to(default: None, which is the context specified byconfig.device).
  • name (string, optional) – A name for the type that will be used in printouts.
  • dtype[source]
  • str – Data type used for scalar elements of variables.

  • broadcastable[source]

  • tuple of bools – Indicates whether the dimensions are broadcastable or not.

  • ndim[source]

  • int – The number of dimensions

  • context_name[source]

  • str – The name of a gpu context on which variables will have their values.

  • name[source]

  • str – A string used to print the type if given.

  • typecode[source]

  • int – The gpuarray typecode for dtype

See also

theano.gof.type.PureType

This function is used internally as part of C code generation.

  • class theano.gpuarray.type.GpuArrayVariable(type, owner=None, index=None, name=None)[source]
  • A variable representing a computation on a certain GPU.

This supports all the operations that TensorTypesupports.

See also

Variable

  • class theano.gpuarray.type.GpuContextType[source]
  • Minimal type used for passing contexts to nodes.

This Type is not a complete type and should never be used forregular graph operations.

  • theano.gpuarray.type.getcontext(_name)[source]
  • Retrive the context associated with a name.

Return the context object mapped to ref that was previouslyregister through reg_context(). Trying to get the contextfor an unregistered ref will raise a exception.

Parameters:name (hashable object) – Name associated with the context we want (usually a string)

  • theano.gpuarray.type.gpusupported(_data)[source]
  • Is the following data supported on the GPU?

Currently, only complex aren’t supported.

Parameters:data (numpy.ndarray__ or TensorVariable) – (it must have dtype and ndim parameter)

  • theano.gpuarray.type.gpuarrayshared_constructor(_value, name=None, strict=False, allow_downcast=None, borrow=False, broadcastable=None, target=)[source]
  • SharedVariable constructor for GpuArrayType.
  • See theano.shared().

    Target:default NoneThe device target. As None is a valid value and we need todifferentiate from the parameter notset and None, we use anotset object.

    • theano.gpuarray.type.list_contexts()[source]
    • Return an iterable of all the registered context names.
    • theano.gpuarray.type.moveto_gpu(_data)[source]
    • Do we want to move this computation to the GPU?

    Currently, we don’t move complex and scalar.

    Parameters:data (numpy.ndarray__ or TensorVariable) – (it must have dtype and ndim parameter)

    • theano.gpuarray.type.regcontext(_name, ctx)[source]
    • Register a context by mapping it to a name.

    The context must be of type GpuContext and the name can beanything hashable (but is usually a string). Only one context canbe registered per name and the second registration for a givenname will raise an error.

    Parameters:

    • name (hashable object) – Name to associate the context with (usually a string)
    • ctx (GpuContext) – Context instance