tensorflow

keras.layers.TimeDistributed with hub.KerasLayer NotImplementedError

时光总嘲笑我的痴心妄想 提交于 2021-01-20 09:36:32
问题 I want to use tf.keras.TimeDistributed() layer with the tf.hub inception_v3 CNN model from the latest TensorFLow V2 version (tf-nightly-gpu-2.0-preview). The output is shown below. It seemst that tf.keras.TimeDistributed() is not fully implemented to work with tf.hub models. Somehow, the shape of the input layer cannot be computed. My question: Is there a workaround this problem? tf.keras.TimeDistributed with regular tf.keras.layer works fine. I just would like to apply the CNN model to each

keras.layers.TimeDistributed with hub.KerasLayer NotImplementedError

给你一囗甜甜゛ 提交于 2021-01-20 09:36:27
问题 I want to use tf.keras.TimeDistributed() layer with the tf.hub inception_v3 CNN model from the latest TensorFLow V2 version (tf-nightly-gpu-2.0-preview). The output is shown below. It seemst that tf.keras.TimeDistributed() is not fully implemented to work with tf.hub models. Somehow, the shape of the input layer cannot be computed. My question: Is there a workaround this problem? tf.keras.TimeDistributed with regular tf.keras.layer works fine. I just would like to apply the CNN model to each

GaussianDropout vs. Dropout vs. GaussianNoise in Keras

旧街凉风 提交于 2021-01-20 09:33:32
问题 Can anyone explain the difference between the different dropout styles? From the documentation, I assumed that instead of dropping some units to zero (dropout), GaussianDropout multiplies those units by some distribution. However, when testing in practice, all units are touched. The result looks more like the classic GaussianNoise. tf.random.set_seed(0) layer = tf.keras.layers.GaussianDropout(.05, input_shape=(2,)) data = np.arange(10).reshape(5, 2).astype(np.float32) print(data) outputs =

ValueError: Input 0 of layer sequential is incompatible with the layer: : expected min_ndim=4, found ndim=3. Full shape received: [8, 28, 28]

China☆狼群 提交于 2021-01-20 09:16:28
问题 I keep on getting this error related to input shape. Any help would be highly appreciated. Thanks! import tensorflow as tf (xtrain, ytrain), (xtest, ytest) = tf.keras.datasets.mnist.load_data() model = tf.keras.Sequential([ tf.keras.layers.Conv2D(16, kernel_size=3, activation='relu'), tf.keras.layers.MaxPooling2D(pool_size=2), tf.keras.layers.Conv2D(32, kernel_size=3, activation='relu'), tf.keras.layers.MaxPooling2D(pool_size=2), tf.keras.layers.Flatten(), tf.keras.layers.Dense(64, activation

Tensorflow 2.0: custom keras metric caused tf.function retracing warning

假如想象 提交于 2021-01-20 07:14:22
问题 When I use the following custom metric (keras-style): from sklearn.metrics import classification_report, f1_score from tensorflow.keras.callbacks import Callback class Metrics(Callback): def __init__(self, dev_data, classifier, dataloader): self.best_f1_score = 0.0 self.dev_data = dev_data self.classifier = classifier self.predictor = Predictor(classifier, dataloader) self.dataloader = dataloader def on_epoch_end(self, epoch, logs=None): print("start to evaluate....") _, preds = self

tensorflow placeholder - understanding `shape=[None,`

我怕爱的太早我们不能终老 提交于 2021-01-19 16:53:37
问题 I'm trying to understand placeholders in tensorflow. Specifically what shape=[None, means in the example below. X = tf.placeholder(tf.float32, shape=[None, 128, 128, 3], name="X") This answer describes it as: You can think of a placeholder in TensorFlow as an operation specifying the shape and type of data that will be fed into the graph.placeholder X defines that an unspecified number of rows of shape (128, 128, 3) of type float32 will be fed into the graph. a Placeholder does not hold state

tensorflow placeholder - understanding `shape=[None,`

回眸只為那壹抹淺笑 提交于 2021-01-19 16:50:33
问题 I'm trying to understand placeholders in tensorflow. Specifically what shape=[None, means in the example below. X = tf.placeholder(tf.float32, shape=[None, 128, 128, 3], name="X") This answer describes it as: You can think of a placeholder in TensorFlow as an operation specifying the shape and type of data that will be fed into the graph.placeholder X defines that an unspecified number of rows of shape (128, 128, 3) of type float32 will be fed into the graph. a Placeholder does not hold state

tensorflow placeholder - understanding `shape=[None,`

蹲街弑〆低调 提交于 2021-01-19 16:49:12
问题 I'm trying to understand placeholders in tensorflow. Specifically what shape=[None, means in the example below. X = tf.placeholder(tf.float32, shape=[None, 128, 128, 3], name="X") This answer describes it as: You can think of a placeholder in TensorFlow as an operation specifying the shape and type of data that will be fed into the graph.placeholder X defines that an unspecified number of rows of shape (128, 128, 3) of type float32 will be fed into the graph. a Placeholder does not hold state

击败酷睿i9之后,有人又拿苹果M1去挑战英伟达V100了

你。 提交于 2021-01-19 12:59:37
有工程师用 M1 版 Mac Mini 训练小架构深度学习模型,结果好像还可以。 选自vanpelt,作者:Chris Van Pelt,机器之心编译,机器之心编辑部。 众所周知,大多数 Mac 产品都是生产力工具,你甚至可以用它们训练神经网络。去年 11 月推出的,搭载 M1 芯片的 Mac 更是将这种生产力水平提到了一个新的高度。 那么,如果拎出来和专业的比一下,M1 版的 Mac 在训练模型方面是个什么水平?为了解答这个疑问,最近有人将 M1 版的 Mac Mini 与 Nvidia V100 放到一起比了一下。 M1 版 Mac Mini 的售价最低是 5000 元左右。此前,国外知名硬件评测网站 anandtech 发布了对这款产品的 详细测试 ,结果显示,在 CPU 性能测试中,M1 版 Mac Mini 的单线程和多线程都很优秀。在 GPU 性能测试中,它在多个基准测试中超越了之前的 Mac 系列产品,在某些情况下还能超越独显产品。 Nvidia V100 则是专业的 AI 训练卡,单精度浮点性能达到 15 TFLOPS,双精度浮点 7.5 TFLOPS,显存带宽 900GB/s,售价高达五位数。当然,你可以选择在 Colab 上租用。 评测者是「Weights and Biases」公司的联合创始人 Chris Van Pelt。Weights and Biases

How can I get the number of CUDA cores in my GPU using Python and Numba?

ⅰ亾dé卋堺 提交于 2021-01-19 09:13:20
问题 I would like to know how to obtain the total number of CUDA Cores in my GPU using Python, Numba and cudatoolkit. 回答1: Most of what you need can be found by combining the information in this answer along with the information in this answer. We'll use the first answer to indicate how to get the device compute capability and also the number of streaming multiprocessors. We'll use the second answer (converted to python) to use the compute capability to get the "core" count per SM, then multiply