forked from PaddlePaddle/Paddle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request PaddlePaddle#44 from Superjomn/refine/buffer
add Bind to Tensor and Buffer
- Loading branch information
Showing
12 changed files
with
139 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
#include "cinn/lang/buffer.h" | ||
|
||
#include "cinn/ir/buffer.h" | ||
|
||
namespace cinn { | ||
namespace lang {} // namespace lang | ||
namespace lang { | ||
|
||
using ir::_Buffer_; | ||
|
||
Buffer::Buffer(const std::string &name) { buffer_ = _Buffer_::Make(name); } | ||
|
||
Buffer::Buffer() { buffer_ = _Buffer_::Make(); } | ||
|
||
} // namespace lang | ||
} // namespace cinn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,26 @@ | ||
#pragma once | ||
|
||
#include "cinn/ir/node.h" | ||
#include "cinn/ir/buffer.h" | ||
|
||
namespace cinn { | ||
namespace lang {} // namespace lang | ||
namespace lang { | ||
|
||
/** | ||
* This is a DSL wrapper for ir::Buffer. | ||
*/ | ||
class Buffer { | ||
public: | ||
Buffer(); | ||
Buffer(const std::string& name); | ||
|
||
ir::_Buffer_* operator->() { return buffer_->As<ir::_Buffer_>(); } | ||
const ir::_Buffer_* operator->() const { return buffer_->As<ir::_Buffer_>(); } | ||
|
||
ir::Buffer buffer() const { return buffer_; } | ||
|
||
private: | ||
ir::Buffer buffer_; | ||
}; | ||
|
||
} // namespace lang | ||
} // namespace cinn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters