MCPcopy Index your code
hub / github.com/tensorflow/tensorboard / setUp

Method setUp

tensorboard/plugins/mesh/mesh_plugin_test.py:43–162  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

41 """Tests for mesh plugin server."""
42
43 def setUp(self):
44 # We use numpy.random to generate meshes. We seed to avoid non-determinism
45 # in this test.
46 np.random.seed(17)
47
48 # Log dir to save temp events into.
49 self.log_dir = self.get_temp_dir()
50
51 # Create mesh summary.
52 with tf.compat.v1.Graph().as_default():
53 tf_placeholder = tf.compat.v1.placeholder
54 sess = tf.compat.v1.Session()
55 point_cloud = test_utils.get_random_mesh(1000)
56 point_cloud_vertices = tf_placeholder(
57 tf.float32, point_cloud.vertices.shape
58 )
59
60 mesh_no_color = test_utils.get_random_mesh(2000, add_faces=True)
61 mesh_no_color_extended = test_utils.get_random_mesh(
62 2500, add_faces=True
63 )
64 mesh_no_color_vertices = tf_placeholder(tf.float32, [1, None, 3])
65 mesh_no_color_faces = tf_placeholder(tf.int32, [1, None, 3])
66
67 mesh_color = test_utils.get_random_mesh(
68 3000, add_faces=True, add_colors=True
69 )
70 mesh_color_vertices = tf_placeholder(
71 tf.float32, mesh_color.vertices.shape
72 )
73 mesh_color_faces = tf_placeholder(tf.int32, mesh_color.faces.shape)
74 mesh_color_colors = tf_placeholder(
75 tf.uint8, mesh_color.colors.shape
76 )
77
78 self.data = [
79 point_cloud,
80 mesh_no_color,
81 mesh_no_color_extended,
82 mesh_color,
83 ]
84
85 # In case when name is present and display_name is not, we will reuse name
86 # as display_name. Summaries below intended to test both cases.
87 self.names = ["point_cloud", "mesh_no_color", "mesh_color"]
88 summary.op(
89 self.names[0],
90 point_cloud_vertices,
91 description="just point cloud",
92 )
93 summary.op(
94 self.names[1],
95 mesh_no_color_vertices,
96 faces=mesh_no_color_faces,
97 display_name="name_to_display_in_ui",
98 description="beautiful mesh in grayscale",
99 )
100 summary.op(

Callers

nothing calls this directly

Calls 11

ReloadMethod · 0.95
rangeFunction · 0.85
opMethod · 0.80
add_graphMethod · 0.80
add_summaryMethod · 0.80
getMethod · 0.65
get_temp_dirMethod · 0.45
GraphMethod · 0.45
joinMethod · 0.45
runMethod · 0.45
get_plugin_appsMethod · 0.45

Tested by

no test coverage detected