MCPcopy Create free account
hub / github.com/pytorch/pytorch / test_tanh

Method test_tanh

caffe2/python/brew_test.py:73–84  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

71 self.assertAlmostEqual(neg.mean(), 0)
72
73 def test_tanh(self):
74 X = np.ones((5, 5)).astype(np.float32) - 0.5
75
76 workspace.FeedBlob("x", X)
77 model = ModelHelper(name="test_model")
78 brew.tanh(model, "x", "out_tanh")
79 model.Validate()
80 workspace.RunNetOnce(model.param_init_net)
81 workspace.RunNetOnce(model.net)
82
83 out = workspace.FetchBlob("out_tanh")
84 self.assertAlmostEqual(out.mean(), np.tanh(0.5), places=5)
85
86 def test_validate(self):
87 model = ModelHelper(name="test_model")

Callers

nothing calls this directly

Calls 6

ValidateMethod · 0.95
ModelHelperClass · 0.90
astypeMethod · 0.80
onesMethod · 0.45
tanhMethod · 0.45
meanMethod · 0.45

Tested by

no test coverage detected