Notas de estudio de la "guía de combate de aprendizaje automático TensorFlow" 1.6.4 aprendizaje extendido

No se puede encontrar la función tf.sub

# 自定义函数3x^2 - x + 10
def custom_polynomial(value):
 return (tf.sub(3 * tf.square(value), value) + 10)

Error:

2019-04-05 22:27:56.753660: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2019-04-05 22:27:57.039490: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1432] Found device 0 with properties:
name: GeForce GTX 650 major: 3 minor: 0 memoryClockRate(GHz): 1.1105
pciBusID: 0000:05:00.0
totalMemory: 1.00GiB freeMemory: 834.65MiB
2019-04-05 22:27:57.039841: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1482] Ignoring visible gpu device (device: 0, name: GeForce GTX 650, pci bus id: 0000:05:00.0, compute capability: 3.0) with Cuda compute capability 3.0. The minimum required Cuda capability is 3.7.
2019-04-05 22:27:57.040420: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-04-05 22:27:57.040761: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988] 0
2019-04-05 22:27:57.041131: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0: N
Traceback (most recent call last):
  File "1.6.4-custom_function.py", line 11, in <module>
    print(sess.run(custom_polynomial(11)))
  File "1.6.4-custom_function.py", line 9, in custom_polynomial
    return (tf.sub(3 * tf.square(value), value) + 10)
AttributeError: module 'tensorflow' has no attribute 'sub'

Razón

Cambios de interfaz, tf.sub se ha cambiado a tf.subtract

Referencia

[1] Algunos cambios de excusa
[2] Código-github modificado

Publicó 41 artículos originales · elogió 7 · 20,000+ visitas

Supongo que te gusta

Origin blog.csdn.net/pkxpp/article/details/89048600
Recomendado
Clasificación