| 380 | } |
| 381 | |
| 382 | Status NewTensorTie(const TensorTieDef& def, |
| 383 | std::unique_ptr<TensorTie>* tie) { |
| 384 | TensorObject internal_object = TensorToObj(*context_.GetTensor(def.id)); |
| 385 | auto converter = converter_builder_.get(); |
| 386 | if (NoopTensorTie::IsSupported(def)) { |
| 387 | return NoopTensorTie::New(def, internal_object, tie); |
| 388 | } |
| 389 | if (DefaultTensorTie::IsSupported(def, converter)) { |
| 390 | return DefaultTensorTie::New(def, internal_object, converter, &env_, tie); |
| 391 | } |
| 392 | if (GlBufferHolder::IsSupported(def, converter)) { |
| 393 | if (!gl_interop_fabric_) { |
| 394 | return InvalidArgumentError( |
| 395 | "GL object is used but InferenceEnvironmentOptions does not have " |
| 396 | "EGL display and context set."); |
| 397 | } |
| 398 | return GlBufferHolder::New(def, internal_object, converter, |
| 399 | gl_interop_fabric_, &env_, tie); |
| 400 | } |
| 401 | if (TwoStepTensorTie::IsSupported(def, converter)) { |
| 402 | return TwoStepTensorTie::New(def, internal_object, converter, &env_, tie); |
| 403 | } |
| 404 | return UnimplementedError("Unsupported tensor tie definition."); |
| 405 | } |
| 406 | |
| 407 | private: |
| 408 | Environment& env_; |
no test coverage detected