MCPcopy Index your code
hub / github.com/tensorflow/tfjs / _create_hub_module

Function _create_hub_module

tfjs-converter/python/test_pip_package.py:128–146  ·  view source on GitHub ↗

Create a TensorFlow Hub module for testing. Args: save_path: The directory path in which to save the model.

(save_path)

Source from the content-addressed store, hash-verified

126
127
128def _create_hub_module(save_path):
129 """Create a TensorFlow Hub module for testing.
130
131 Args:
132 save_path: The directory path in which to save the model.
133 """
134 # Module function that doubles its input.
135 def double_module_fn():
136 w = tf.Variable([2.0, 4.0])
137 x = tf.compat.v1.placeholder(dtype=tf.float32)
138 hub.add_signature(inputs=x, outputs=x*w)
139 graph = tf.Graph()
140 with graph.as_default():
141 spec = hub.create_module_spec(double_module_fn)
142 m = hub.Module(spec)
143 # Export the module.
144 with tf.compat.v1.Session(graph=graph) as sess:
145 sess.run(tf.compat.v1.global_variables_initializer())
146 m.export(save_path, sess)
147
148def _create_frozen_model(save_path):
149 graph = tf.Graph()

Callers 1

setUpClassMethod · 0.85

Calls 1

runMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…