Skip to content

Commit 1802e55

Browse files
chenfeiyue-cfySven
authored andcommitted
modified cumsum header && resolve conflict in README.md
1 parent 264e491 commit 1802e55

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

include/tim/vx/operation.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,16 @@ class Operation {
4949
std::unique_ptr<OpImpl>& impl();
5050
const std::unique_ptr<OpImpl>& impl() const;
5151
virtual const std::vector<std::shared_ptr<Tensor>> ConstantInputsTensor() const;
52-
virtual void HandleAfterBindInput(const std::shared_ptr<Tensor>& tensor, int32_t input_idx);
52+
5353
protected:
5454
bool IsAllInputsConst() const;
5555
std::unique_ptr<OpImpl> impl_;
56+
57+
private:
58+
// Post processing at the final step on BindInput func
59+
// - tensor : input tensor
60+
// - input_idx: the index of input tensor
61+
virtual void OnBindInputPostProc(const std::shared_ptr<Tensor>& tensor, int32_t input_idx);
5662
};
5763

5864
} // namespace vx

include/tim/vx/ops/cumsum.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,14 @@ namespace ops {
4747
class CumSum : public BuiltinOp {
4848
public:
4949
CumSum(Graph* Graph, int32_t axis=0, int32_t exclusive=0, int32_t reverse=0);
50+
5051
std::shared_ptr<Operation> Clone(std::shared_ptr<Graph>& graph) const override;
51-
void HandleAfterBindInput(const std::shared_ptr<Tensor>& tensor, int32_t input_idx) override;
5252

5353
protected:
5454
int32_t axis_, exclusive_, reverse_;
55+
56+
private:
57+
void OnBindInputPostProc(const std::shared_ptr<Tensor>& tensor, int32_t input_idx) override;
5558
};
5659

5760
} // namespace ops

src/tim/vx/operation.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const std::unique_ptr<OpImpl>& Operation::impl() const { return impl_; }
4242
Operation& Operation::BindInput(const std::shared_ptr<Tensor>& tensor) {
4343
impl_->BindInput(tensor);
4444
impl_->graph_->UpdateTensorConsumersMap(tensor, this);
45-
HandleAfterBindInput(tensor, impl_->input_tensor_index - 1);
45+
OnBindInputPostProc(tensor, impl_->input_tensor_index - 1);
4646
return *this;
4747
}
4848

@@ -90,7 +90,7 @@ const std::vector<std::shared_ptr<Tensor>> Operation::ConstantInputsTensor() con
9090
return {};
9191
}
9292
}
93-
void Operation::HandleAfterBindInput(const std::shared_ptr<Tensor>& tensor, int32_t input_idx){
93+
void Operation::OnBindInputPostProc(const std::shared_ptr<Tensor>& tensor, int32_t input_idx){
9494
(void) tensor;
9595
(void) input_idx;
9696
}

src/tim/vx/ops/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,12 @@ GroupedConv1d|GROUPED_CONV1D|Mapped|[tf.keras.layers.Conv1D](https://tensorflow.
116116
Mod|MOD|Mapped|[Onnx.Mod](https://github.com/onnx/onnx/blob/main/docs/Operators.md#Mod)
117117
Selu|SELU|Mapped|[tf.keras.activations.selu](https://www.tensorflow.org/api_docs/python/tf/keras/activations/selu)
118118
Celu|CELU|Mapped|[Onnx.celu](https://github.com/onnx/onnx/blob/main/docs/Operators.md#Celu)
119+
Sign|SIGN|Mapped|[tf.math.sign](https://www.tensorflow.org/api_docs/python/tf/math/sign)
120+
SoftSign|SOFTSIGN|Mapped|[tf.keras.activations.softsign](https://www.tensorflow.org/api_docs/python/tf/keras/activations/softsign)
121+
CumSum|CUMSUM|Mapped|[tf.math.cumsum](https://www.tensorflow.org/api_docs/python/tf/math/cumsum)
119122
Rcp|RCP|Mapped|[tf.math.reciprocal](https://www.tensorflow.org/api_docs/python/tf/math/reciprocal)
120123
MaxPool3d|MAX_POOL3D|Mapped|[Onnx.MaxPool](https://github.com/onnx/onnx/blob/main/docs/Operators.md#MaxPool)
121124
|UnidirectionalSequenceRNN|UNIDIRECTIONAL_SEQUENCE_RNN|Planned 22Q3|[ANEURALNETWORKS_UNIDIRECTIONAL_SEQUENCE_RNN](https://developer.android.com/ndk/reference/group/neural-networks#group___neural_networks_1ggaabbe492c60331b13038e39d4207940e0ae11aa1d461d2abaa117f6ee2cb503dd8)
122-
CumSum|CUMSUM|Mapped|[tf.math.cumsum](https://www.tensorflow.org/api_docs/python/tf/math/cumsum)
123125
|BidirectionalSequenceRNN|BIDIRECTIONAL_SEQUENCE_RNN|Planned 22Q3|[ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN](https://developer.android.com/ndk/reference/group/neural-networks#group___neural_networks_1ggaabbe492c60331b13038e39d4207940e0a487fc5ae247de828f13e62b99f259f3c)
124126
|BidirectionalSequenceLSTM|BIDIRECTIONAL_SEQUENCE_LSTM|Mapped|[ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_LSTM](https://developer.android.com/ndk/reference/group/neural-networks#group___neural_networks_1ggaabbe492c60331b13038e39d4207940e0a492a71cb7aa50b9a1a834a3cb269d778)
125127
|UnidirectionalSequenceLSTM|LSTM_OVXLIB|Mapped|[ANEURALNETWORKS_UNIDIRECTIONAL_SEQUENCE_LSTM](https://developer.android.com/ndk/reference/group/neural-networks#group___neural_networks_1ggaabbe492c60331b13038e39d4207940e0aaf30e491ad0b1fc7602cbde695b2c859)

src/tim/vx/ops/cumsum.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ CumSum::CumSum(Graph* graph, int32_t axis, int32_t exclusive, int32_t reverse)
3737
this->impl()->node()->nn_param.cumsum.reverse = reverse_;
3838
}
3939

40-
void CumSum::HandleAfterBindInput(const std::shared_ptr<Tensor>& tensor, int32_t input_idx){
40+
void CumSum::OnBindInputPostProc(const std::shared_ptr<Tensor>& tensor, int32_t input_idx){
4141
if (axis_ < 0){
4242
axis_ += tensor->GetShape().size();
4343
(void) input_idx;

0 commit comments

Comments
 (0)