Conversation
It is used to check the consistency between the BufferArg type argument received by Function and the original type argument.
…(do not contains data).
tianbingsz
left a comment
There was a problem hiding this comment.
Looks very good to me. Approve it to make you move fast. Only minor comments need to be addressed.
| std::make_shared<BufferArg>(cpuMemory_.back()->getBuf(), | ||
| output.valueType(), | ||
| output.shape(), | ||
| ASSIGN_TO)); |
There was a problem hiding this comment.
should we use argType here? pass from void addOutputs(const BufferArg& output, argType) ?
There was a problem hiding this comment.
嗯,这里需要再考虑一下,目前有的Function实现上暂时只支持ADD_TO。我本来想的是是否所有Function都需要支持ASSIGN_TO。
| std::make_shared<BufferArg>(gpuMemory_.back()->getBuf(), | ||
| output.valueType(), | ||
| output.shape(), | ||
| ASSIGN_TO)); |
|
|
||
| // TODO: need be implemented. | ||
| } | ||
|
|
There was a problem hiding this comment.
TODO, we may also need void addInputs(const SparseMatrixArg& input), I think I can do it later.
paddle/function/FunctionTest.h
Outdated
|
|
||
| void initArg(SequenceIdArg& arg, size_t batchSize) { | ||
| size_t numSeqs = arg.numSeqs(); | ||
| int* buf = (int*)arg.data(); |
There was a problem hiding this comment.
can we use reinterpret_cast<int*>(arg.data())?
| autotest::TensorCheckErr(cpuVector, gpuVector); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
TODO, do we need to compare the output of two sparse matrice or two sequences? If needed, we can do it later.
| std::vector<BufferArgPtr>& outputs) { | ||
| BufferArgs inArgs; | ||
| BufferArgs outArgs; | ||
| for (auto arg : inputs) { |
| } | ||
|
|
||
| void testBufferArgs(const BufferArgs& inputs, const CheckBufferArg& check) { | ||
| check(inputs[0]); |
There was a problem hiding this comment.
should we add CHECK_GE(inputs.size(), 1)?
| argments.addArg(*matrix); | ||
| std::vector<CheckBufferArg> checkFunc; | ||
| checkFunc.push_back(check); | ||
| testBufferArgs(argments, checkFunc); |
There was a problem hiding this comment.
Since we only have one buffer arg and check function, can we directly write: check(argments)? Just curious :)
There was a problem hiding this comment.
testBufferArgs(argments, checkFunc);这么写目的就是构造Function的调用过程;直接写成check(argments)的话相当于直接在TEST里面check。
|
|
||
| ~BufferArgs() { | ||
| for (auto arg : _args_) { | ||
| delete arg; |
There was a problem hiding this comment.
Curious, if args delete its arg, what will happen to the corresponding element in args_(std::vector<BufferArg*>)? Do we really need to worry about it?
There was a problem hiding this comment.
这里只是防止内存泄漏,~BufferArgs析构后,再使用BufferArgs::args_已经是非法了。
| SequenceIdArg(const TensorShape& shape, ArgType argType = UNSPECIFIED) | ||
| : BufferArg(VALUE_TYPE_INT32, shape, argType) { | ||
| CHECK_EQ(shape_.ndims(), (size_t)1); | ||
| numSeqs_ = shape_[0] - 1; |
There was a problem hiding this comment.
Do we need to CHECK(shape_[0] > 1) or CHECK(shape_[0] >= 1) ?
There was a problem hiding this comment.
Done。
Add CHECK_GT(shape_[0], 1);
… cutlass_library (PaddlePaddle#1132) * Adding more tiles in the cutlass_library for mixed-input support. * fix rebase issue * more tiles to upcast a
Uh oh!
There was an error while loading. Please reload this page.