载入中...
搜索中...
未找到
AgentTensor.cpp
浏览该文件的文档.
2#include <simplesquirrel/simplesquirrel.hpp>
3#include "agent/Agent.h"
5#include "common/Capability.h"
6
7namespace eve::agent {
9 std::unique_ptr<IPolicyBackend> provider;
10 std::unique_ptr<IGpuPolicyBackend> gpu;
11};
13AgentTensor::AgentTensor() : impl_(std::make_unique<Impl>()) {
14 impl_->provider = makeTensorBackend().expect("Tensor backend creation failed");
15 impl_->gpu = makeGpuBackend().expect("GPU provider creation failed");
16 cap::provide<IPolicyBackend>(impl_->provider.get());
17 cap::provide<IGpuPolicyBackend>(impl_->gpu.get());
18}
20 cap::revoke<IGpuPolicyBackend>(impl_->gpu.get());
21 cap::revoke<IPolicyBackend>(impl_->provider.get());
22}
23void AgentTensor::expose(ssq::Table& table) {
24 auto cls = table.addClass(name, AgentTensor::create, false);
25 expose(cls);
26}
27void AgentTensor::expose(ssq::Class& cls) { cls.addFunc("getName", &AgentTensor::getName); }
28} // namespace eve::agent
HSQOBJECT cls
Definition ECS.cpp:21
std::string name
#define Module_IMPL(ModuleName, newExpr)
Definition Module.h:26
virtual std::string getName() const =0
Returns the name.
Manager-owned optional tensor backend. Owner thread only; revokes before destruction.
Definition AgentTensor.h:7
~AgentTensor() override
Revoke the provider, then destroy its owning implementation.
AgentTensor()
Register the tensor inference provider; instantiate once on the composition thread.
Result< std::unique_ptr< IGpuPolicyBackend > > makeGpuBackend()
Create an owning GPU provider; compile lazily on the device owner thread.
Result< std::unique_ptr< IPolicyBackend > > makeTensorBackend()
Create an owning tensor eager CPU inference provider; caller owns registration.
std::unique_ptr< IPolicyBackend > provider
std::unique_ptr< IGpuPolicyBackend > gpu