Slackbot
05/05/2022, 10:49 AMAaron Pham
05/06/2022, 1:17 PM@tf.function . Usually, inference function that is used by default by tensorflow is __call__ : (an toy example)Aaron Pham
05/06/2022, 1:17 PMclass NativeModel(tf.Module):
def __init__(self):
super().__init__()
self.weights = np.asfarray([[1.0], [1.0], [1.0], [1.0], [1.0]])
self.dense = lambda inputs: tf.matmul(inputs, self.weights)
@tf.function(
input_signature=[tf.TensorSpec(shape=[1, 5], dtype=tf.float64, name="inputs")]
)
def __call__(self, inputs):
return self.dense(inputs)Aaron Pham
05/06/2022, 1:17 PMAaron Pham
05/08/2022, 3:27 PM