MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / TEST

Function TEST

oneflow/api/cpp/tests/tensor_test.cpp:22–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20namespace oneflow_api {
21
22TEST(Api, device) {
23 EnvScope scope;
24
25 auto device = Device("cpu");
26 ASSERT_EQ(device.type(), "cpu");
27
28#ifdef WITH_CUDA
29 device = Device("cuda:0");
30 ASSERT_EQ(device.type(), "cuda");
31 ASSERT_EQ(device.device_id(), 0);
32
33 device = Device("cuda", 1);
34 ASSERT_EQ(device.type(), "cuda");
35 ASSERT_EQ(device.device_id(), 1);
36#endif
37}
38
39TEST(Api, tensor) {
40 EnvScope scope;

Callers

nothing calls this directly

Calls 14

RandomShapeFunction · 0.85
zeros_Method · 0.80
copy_toMethod · 0.80
DeviceClass · 0.50
ShapeClass · 0.50
typeMethod · 0.45
device_idMethod · 0.45
shapeMethod · 0.45
deviceMethod · 0.45
dtypeMethod · 0.45
CountMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected