I am wondering if someone can help me understand how to translate a short TF model into Torch.
Consider this TF setup:
inp = layers.Input(shape = (386, 1024, 1), dtype = tf.float32)
x = layers.Dense(2)(inp) # [None, 386, 1024, 2]
start, end = tf.split(x, 2, axis=-1)
start = tf.squeeze(start, axis = -1)
end = tf.squeeze(end, axis = -1)
model = Model(inputs = inp, outputs = [start, end])
Specifically, I am not sure what Torch command would turn my data from 386, 1024, 1 to 386, 1024, 2 nor do I understand anything that this says its doing: Model(inputs = inp, outputs = [start, end])
Is:
inp = layers.Input(shape = (386, 1024, 1), dtype = tf.float32)
x = layers.Dense(2)(inp) # [None, 386, 1024, 2]
Equivalent to:
X = torch.randn(386, 1024, 1)
X = X.expand(386, 1024, 2)
X.shape [386, 1024, 2]