Operating environment
GeForce GTX 1070 (8GB)
ASRock Z170M Pro4S [Intel Z170chipset]
Ubuntu 14.04 LTS desktop amd64
TensorFlow v0.11
cuDNN v5.1 for Linux
CUDA v8.0
Python 2.7.6
IPython 5.1.0 -- An enhanced Interactive Python.
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
GNU bash, version 4.3.8(1)-release (x86_64-pc-linux-gnu)
Questions I had while implementing the TensorFlow code.
>>> import numpy as np
>>> inpbt = np.array([1,2,3], dtype='f')
>>> print(inpbt)
[ 1. 2. 3.]
>>> inpbt
array([ 1., 2., 3.], dtype=float32)
It is implemented by the code learn_xxyyfunc_170321.py, and when the input batch is output by print (), it becomes the latter notation of ʻarray (..., dtype = ...)`.
On the other hand, when executing in interactive mode (?) As described above, in the example using print (), the notation of ʻarray and
dtype` is not seen.
I also tried a short script.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
# on Python 2.7.6
inpbt = np.array([1,2,3], dtype='f')
print(inpbt)
Run
$ python test_python_170324a.py
[ 1. 2. 3.]
Is there any option to use ʻarray (..., dtype = ...)` notation when executing a Python script?
test_python_170324a.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
# Python 2.7.6
inpbt = np.array([1,2,3], dtype='f')
print(inpbt)
alist = list([inpbt])
print(alist)
Run
$ python test_python_170324a.py
[ 1. 2. 3.]
[array([ 1., 2., 3.], dtype=float32)]
If you enclose the list type with []
and enclose it with list (), it becomes ʻarray (..., dtype = ...)` notation.
Recommended Posts