return *this;
}
TVMRetValue& operator=(PackedFunc f) {
- this->SwitchToClass(kTVMPackedFuncHandle, f);
+ if (f == nullptr) {
+ this->SwitchToPOD(kTVMNullptr);
+ } else {
+ this->SwitchToClass(kTVMPackedFuncHandle, f);
+ }
return *this;
}
template<typename FType>
type_codes_[i] = kTVMBytes;
}
TVM_ALWAYS_INLINE void operator()(size_t i, const PackedFunc& value) const {
- values_[i].v_handle = const_cast<PackedFunc*>(&value);
- type_codes_[i] = kTVMPackedFuncHandle;
+ if (value != nullptr) {
+ values_[i].v_handle = const_cast<PackedFunc*>(&value);
+ type_codes_[i] = kTVMPackedFuncHandle;
+ } else {
+ values_[i].v_handle = nullptr;
+ type_codes_[i] = kTVMNullptr;
+ }
}
template<typename FType>
TVM_ALWAYS_INLINE void operator()(size_t i, const TypedPackedFunc<FType>& value) const {
raise_err()
remote.cpu().sync()
+ with pytest.raises(AttributeError):
+ f3 = remote.system_lib()["notexist"]
+
temp = rpc.server._server_env([])
server = rpc.Server("localhost")
remote = tvm.rpc.PopenSession(path_minrpc)
ctx = remote.cpu(0)
f1 = remote.system_lib()
+
a = tvm.nd.array(np.random.uniform(size=102).astype(A.dtype), ctx)
b = tvm.nd.array(np.zeros(102, dtype=A.dtype), ctx)
time_f = f1.time_evaluator("myadd", remote.cpu(0), number=1)