摘要:
import tensorflow as tf from tensorflow import keras from tensorflow.keras import datasets import os # do not print irrelevant information # os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # x: [60k,28,28], 阅读全文
摘要:
import tensorflow as tf a = tf.random.normal([3, 3]) a mask = a > 0 mask # 为True元素,即>0的元素的索引 indices = tf.where(mask) indices # 取回>0的值 tf.gather_nd(a, indices) A = tf.ones([3, 3]) B = tf.zeros([3, 3]) 阅读全文