我想分析一下,当同时使用tensorflow和keras时,为什么在我的简单代码中会出现这样的错误X=tf.placeholder(tf.float32,shape=(None,1))
hidden=Dense(neu, activation='sigmoid',
kernel_regularizer=keras.regularizers.l1_l2(l1=lamb, l2=lamb))
(X) #colocate_with occurs
neural=Dense(1,
kernel_regularizer=keras.regularizers.l1_l2(l1=lamb, l2=lamb))
(hidden)
output=X+X**2*neural
first_term=tf.gradients(tf.gradients(output,X),X)[0] #to_int32 occurs
详细警告是WARNING:tensorflow:From
D:\Anaconda3\envs\ML\lib\site-packages\tensorflow\python\framework\op_def_library.py:263:
colocate_with (from tensorflow.python.framework.ops) is deprecated and
will be removed in a future version. Instructions for updating:
Colocations handled automatically by placer.
以及WARNING:tensorflow:From
D:\Anaconda3\envs\ML\lib\site-packages\tensorflow\python\ops\math_ops.py:3066:
to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will
be removed in a future version. Instructions for updating: Use tf.cast
instead.
我认为这是两个独立的问题。
你有什么解决办法吗?在