Я пытаюсь преобразовать код TensorFlow в PyTorch.
def get_trainer():
x = ph([None,None,1])
x = tf.clip_by_value(x,clip_value_max=1.,clip_value_min=0.)
code_noise = tf.Variable(1.0)
linear_code = model(x)
noisy_code = linear_code - tf.random_normal(stddev=code_noise,shape=tf.shape(linear_code))
binary_code = Act('sigmoid')(noisy_code)
y = res(binary_code)
quantization_threshold = tf.Variable(0.5)
binary_code_test = tf.cast(binary_code>quantization_threshold,tf.float32)
y_test = res(binary_code_test)