pytorch/caffe2/core/net_async_task.h
Ilia Cherniavskii e9cd781681 Back out "Revert D13043261: [caffe2] Task graph and task future abstractions in executor"
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/15030

Reviewed By: bddppq

Differential Revision: D13408998

fbshipit-source-id: 9eb675e09fbc4829eab34df7aa660a0590816feb
2018-12-10 19:30:58 -08:00

39 lines
833 B
C++

#ifndef CAFFE2_NET_ASYNC_TASK_H
#define CAFFE2_NET_ASYNC_TASK_H
#include "caffe2/core/net_async_base.h"
#include "caffe2/core/net_async_task_future.h"
#include "caffe2/core/operator.h"
#include <vector>
namespace caffe2 {
// AsyncTask represents an asynchronous execution of a chain of ops.
class AsyncTask {
public:
AsyncTask(const std::vector<OperatorBase*>& ops);
bool Run(const ExecutionOptions& options);
void Reset();
DeviceOption GetDeviceOption() const;
AsyncTaskFuture& GetFuture();
const AsyncTaskFuture& GetFuture() const;
private:
void handleChainError(
OperatorBase* op,
const char* err_msg,
bool save_exception = false);
std::vector<OperatorBase*> ops_;
DeviceOption device_option_;
AsyncTaskFuture future_;
};
} // namespace caffe2
#endif // CAFFE2_NET_ASYNC_TASK_H