Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions paddle/framework/operator.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ class OperatorBase {
std::shared_ptr<std::unordered_map<std::string, int>> in_out_idxs_;
};

class OperatorContext {
class InferShapeContext {
public:
OperatorContext(const OperatorBase* op, const Scope& scope)
InferShapeContext(const OperatorBase* op, const Scope& scope)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that InferShapeContext::op_ is of reference type. Should we make this constructor parameter op also a reference?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea! done.

: op_(*op), scope_(scope) {}

size_t InputSize() const { return op_.inputs_.size(); }
Expand Down Expand Up @@ -234,12 +234,6 @@ class OperatorContext {
const Scope& scope_;
};

class InferShapeContext : public OperatorContext {
public:
InferShapeContext(const OperatorBase* op, const Scope& scope)
: OperatorContext(op, scope) {}
};

template <typename T>
struct EigenDeviceConverter;

Expand All @@ -255,11 +249,11 @@ struct EigenDeviceConverter<platform::GPUPlace> {
};
#endif

class ExecutionContext : public OperatorContext {
class ExecutionContext : public InferShapeContext {
public:
ExecutionContext(const OperatorBase* op, const Scope& scope,
const platform::DeviceContext* device_context)
: OperatorContext(op, scope), device_context_(device_context) {}
: InferShapeContext(op, scope), device_context_(device_context) {}

template <typename PlaceType,
typename DeviceType =
Expand Down