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

Method AddResourceInput

tensorflow/core/kernels/ops_testutil.h:150–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148 // container name.
149 template <typename T>
150 void AddResourceInput(const string& container, const string& name,
151 T* resource) {
152 CHECK_GT(input_types_.size(), inputs_.size())
153 << "Adding more inputs than types; perhaps you need to call MakeOp";
154 ResourceMgr* rm = device_->resource_manager();
155 std::string container_name =
156 container == "" ? rm->default_container() : container;
157 EXPECT_TRUE(rm->Create(container_name, name, resource).ok());
158 TypeIndex type_index = MakeTypeIndex<T>();
159 ResourceHandle handle;
160 handle.set_device(device_->name());
161 handle.set_container(container_name);
162 handle.set_name(name);
163 handle.set_hash_code(type_index.hash_code());
164 handle.set_maybe_type_name(type_index.name());
165 Tensor* input = new Tensor(allocator(), DT_RESOURCE, TensorShape({}));
166 input->scalar<ResourceHandle>()() = handle;
167 tensors_.push_back(input);
168 inputs_.push_back({nullptr, input});
169 }
170
171 // Runs an operation producing 'num_outputs' outputs.
172 //

Callers

nothing calls this directly

Calls 13

set_containerMethod · 0.80
set_hash_codeMethod · 0.80
set_maybe_type_nameMethod · 0.80
nameMethod · 0.65
TensorShapeClass · 0.50
sizeMethod · 0.45
resource_managerMethod · 0.45
okMethod · 0.45
CreateMethod · 0.45
set_deviceMethod · 0.45
set_nameMethod · 0.45
hash_codeMethod · 0.45

Tested by

no test coverage detected