MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TEST_F

Function TEST_F

tensorflow/compiler/jit/xla_kernel_creator_test.cc:95–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95TEST_F(XlaKernelCreatorTest, OneFloatOneResourceArgument) {
96 FunctionDef fdef = XTimesY();
97 (*fdef.mutable_attr())["_XlaCompile"] = BoolAttr(true);
98 Init({fdef});
99 XlaKernelCreator xla_kernel_creator;
100
101 Status status = xla_kernel_creator.CreateKernel(
102 flr_, ToNodeDef(R"pb(
103 name: 'XTimesY' op: 'XTimesY' input: 'a' input: 'b'
104 )pb"),
105 &kernel_);
106 ASSERT_TRUE(status.ok()) << status.ToString();
107
108 EXPECT_EQ("XTimesY", kernel_->name());
109 EXPECT_EQ("XTimesY", kernel_->type_string());
110
111 EXPECT_EQ(2, kernel_->num_inputs());
112 EXPECT_EQ(DT_FLOAT, kernel_->input_type(0));
113 EXPECT_EQ(DT_RESOURCE, kernel_->input_type(1));
114 EXPECT_EQ(DEVICE_MEMORY, kernel_->input_memory_types()[0]);
115 EXPECT_EQ(HOST_MEMORY, kernel_->input_memory_types()[1]);
116
117 EXPECT_EQ(1, kernel_->num_outputs());
118 EXPECT_EQ(DT_FLOAT, kernel_->output_type(0));
119 EXPECT_EQ(DEVICE_MEMORY, kernel_->output_memory_types()[0]);
120}
121
122TEST_F(XlaKernelCreatorTest, FailsIfXlaCompileAttrNotSet) {
123 FunctionDef fdef = XTimesY();

Callers

nothing calls this directly

Calls 12

XTimesYFunction · 0.85
BoolAttrFunction · 0.85
ToNodeDefFunction · 0.70
nameMethod · 0.65
InitFunction · 0.50
CreateKernelMethod · 0.45
okMethod · 0.45
ToStringMethod · 0.45
num_inputsMethod · 0.45
input_typeMethod · 0.45
num_outputsMethod · 0.45
output_typeMethod · 0.45

Tested by

no test coverage detected