我想将Follow pytorch网络(v1.2)更改为tensorflow。我在 tf.nn.conv2d 和 tf.keras.layers.Conv2D 之间感到困惑,我该选择什么?
import firebase from 'firebase';
import 'firebase/app';
import 'firebase/firestore'
import 'firebase/auth';
const config = { /* COPY THE ACTUAL CONFIG FROM FIREBASE CONSOLE */
(there is my api info)
};
const fire = firebase.initializeApp(config);
export default fire;
答案 0 :(得分:3)
tf.nn.conv2d
是功能性api,tf.keras.layers.Conv2D
是层级api。您应该使用后一种。它与torch.nn.functional.conv2d
和torch.nn.Conv2D
之间的关系非常相似。
import tensorflow as tf
from tensorflow.keras import Sequential
from tensorflow.keras.layers import Conv2D, ReLU, BatchNormalization
model = Sequential()
model.add(Conv2D(filters=10, kernel_size=3, strides=1))
model.add(BatchNormalization())
model.add(ReLU())