In the previous chapter, while discussing the data types, we created and used Theano variables. To reiterate, we would use the following syntax to create a variable in Theano −
x = theano.tensor.fvector('x')
In this statement, we have created a variable x of type vector containing 32-bit floats. We are also naming it as x. The names are generally useful for debugging.
To declare a vector of 32-bit integers, you would use the following syntax −
i32 = theano.tensor.ivector
Here, we do not specify a name for the variable.
To declare a three-dimensional vector consisting of 64-bit floats, you would use the following declaration −
f64 = theano.tensor.dtensor3
The various types of constructors along with their data types are listed in the table below −
You may use a generic vector constructor and specify the data type explicitly as follows −
x = theano.tensor.vector ('x', dtype=int32)
In the next chapter, we will learn how to create shared variables.