1) Theano main support symbol matrix expression
(2) Theano and NumPy have broadcasting:numpy in the dynamic, and Theano need to know before this is which dimension needs to be broadcast. Given the following table for different types of data, the base types are scalar, vector, row, col, Matrix, Tensor3, Tensor4, and then the 8, 16, 32, 64 bits corresponding to the shaping int are B, W, I, l The float type corresponds to 32, 64 bits is F, the D;complex type corresponds to 64, 128 bits are C, Z.
Constructor |
Dtype |
Ndim |
Shape |
broadcastable |
Bscalar |
int8 |
0 |
() |
() |
Bvector |
int8 |
1 |
(?,) |
(False,) |
Brow |
int8 |
2 |
(1,?) |
(True, False) |
Bcol |
int8 |
2 |
(?, 1) |
(False, True) |
Bmatrix |
int8 |
2 |
(?,?) |
(False, False) |
Btensor3 |
int8 |
3 |
(?,?,?) |
(False, False, false) |
Btensor4 |
int8 |
4 |
(?,?,?,?) |
(False, False, false, false) |
Wscalar |
Int16 |
0 |
() |
() |
Wvector |
Int16 |
1 |
(?,) |
(False,) |
Wrow |
Int16 |
2 |
(1,?) |
(True, False) |
Wcol |
Int16 |
2 |
(?, 1) |
(False, True) |
Wmatrix |
Int16 |
2 |
(?,?) |
(False, False) |
Wtensor3 |
Int16 |
3 |
(?,?,?) |
(False, False, false) |
Wtensor4 |
Int16 |
4 |
(?,?,?,?) |
(False, False, false, false) |
Iscalar |
Int32 |
0 |
() |
() |
Ivector |
Int32 |
1 |
(?,) |
(False,) |
IRow |
Int32 |
2 |
(1,?) |
(True, False) |
Icol |
Int32 |
2 |
(?, 1) |
(False, True) |
Imatrix |
Int32 |
2 |
(?,?) |
(False, False) |
Itensor3 |
Int32 |
3 |
(?,?,?) |
(False, False, false) |
Itensor4 |
Int32 |
4 |
(?,?,?,?) |
(False, False, false, false) |
Lscalar |
Int64 |
0 |
() |
() |
Lvector |
Int64 |
1 |
(?,) |
(False,) |
Lrow |
Int64 |
2 |
(1,?) |
(True, False) |
LCol |
Int64 |
2 |
(?, 1) |
(False, True) |
Lmatrix |
Int64 |
2 |
(?,?) |
(False, False) |
Ltensor3 |
Int64 |
3 |
(?,?,?) |
(False, False, false) |
Ltensor4 |
Int64 |
4 |
(?,?,?,?) |
(False, False, false, false) |
Dscalar |
Float64 |
0 |
() |
() |
Dvector |
Float64 |
1 |
(?,) |
(False,) |
Drow |
Float64 |
2 |
(1,?) |
(True, False) |
Dcol |
Float64 |
2 |
(?, 1) |
(False, True) |
Dmatrix |
Float64 |
2 |
(?,?) |
(False, False) |
Dtensor3 |
Float64 |
3 |
(?,?,?) |
(False, False, false) |
Dtensor4 |
Float64 |
4 |
(?,?,?,?) |
(False, False, false, false) |
Fscalar |
Float32 |
0 |
() |
() |
Fvector |
Float32 |
1 |
(?,) |
(False,) |
Frow |
Float32 |
2 |
(1,?) |
(True, False) |
Fcol |
Float32 |
2 |
(?, 1) |
(False, True) |
Fmatrix |
Float32 |
2 |
(?,?) |
(False, False) |
Ftensor3 |
Float32 |
3 |
(?,?,?) |
(False, False, false) |
Ftensor4 |
Float32 |
4 |
(?,?,?,?) |
(False, False, false, false) |
Cscalar |
Complex64 |
0 |
() |
() |
Cvector |
Complex64 |
1 |
(?,) |
(False,) |
Crow |
Complex64 |
2 |
(1,?) |
(True, False) |
Ccol |
Complex64 |
2 |
(?, 1) |
(False, True) |
Cmatrix |
Complex64 |
2 |
(?,?) |
(False, False) |
Ctensor3 |
Complex64 |
3 |
(?,?,?) |
(False, False, false) |
Ctensor4 |
Complex64 |
4 |
(?,?,?,?) |
(False, False, false, false) |
Zscalar |
complex128 |
0 |
() |
() |
Zvector |
complex128 |
1 |
(?,) |
(False,) |
Zrow |
complex128 |
2 |
(1,?) |
(True, False) |
Zcol |
complex128 |
2 |
(?, 1) |
(False, True) |
Zmatrix |
complex128 |
2 |
(?,?) |
(False, False) |
Ztensor3 |
complex128 |
3 |
(?,?,?) |
(False, False, false) |
Ztensor4 |
complex128 |
4 |
(?,?,?,?) |
(False, False, false, false) |
3. A reference to the. py file between different directories in Python: (1) in the current directory, directly through the import filename to the suffix can be; (2) The package contains the __init__.py file and some other. py files, by
From package_name import module_name or
From package_name Import * can be referenced; (3) by adding the corresponding directory of the PY to the corresponding reference file search path of the PY;
In the above (2) to distinguish between the reference attribute and method from module--------------when should you use the From module import?
- If you want to access the properties and methods of the module frequently, and do not want to knock the module name over and over, use the From module import.
- If you want to selectively import certain properties and methods without wanting anything else, use the From module import.
- If the module contains properties and methods that have the same name as one of your modules, You must use the Import module to avoid name collisions.
Theano supported arrays, vectors, matrix expressions