Betriebsumgebung
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)
Fragen, die ich bei der Implementierung des TensorFlow-Codes hatte.
>>> import numpy as np
>>> inpbt = np.array([1,2,3], dtype='f')
>>> print(inpbt)
[ 1. 2. 3.]
>>> inpbt
array([ 1., 2., 3.], dtype=float32)
Es wird durch den Code learn_xxyyfunc_170321.py implementiert, und wenn der Eingabestapel von print () ausgegeben wird, wird letzterer als "array (..., dtype = ...)" geschrieben.
Andererseits kann bei der Ausführung im interaktiven Modus (?) Wie oben beschrieben, die Notation von "Array" und "D-Typ" im Beispiel mit print () nicht gesehen werden.
Ich habe auch ein kurzes Skript ausprobiert.
#!/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)
Lauf
$ python test_python_170324a.py
[ 1. 2. 3.]
Gibt es eine Option zur Verwendung der Notation array (..., dtype = ...)
, wenn das Python-Skript ausgeführt wird?
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)
Lauf
$ python test_python_170324a.py
[ 1. 2. 3.]
[array([ 1., 2., 3.], dtype=float32)]
Wenn Sie den Listentyp mit "[]" und mit list () einschließen, wird er zur "Array (..., dtype = ...)" - Notation.
Recommended Posts