How to make the weight obtained by convolution2dlayer non-negative?

조회 수: 3 (최근 30일)
CHAO WANG 2020년 12월 20일
댓글: CHAO WANG 2021년 1월 5일
I am training a simple network. I need to constrain the weights of one layer of convolution2dlayer to be >0. For example, in keras, Layer weight constraints are implemented using tf.keras.constraints.NonNeg(). Can this function be realized in matlab? If there is no direct way, are there indirect constraints?

채택된 답변

Abhishek Gupta
Abhishek Gupta 2020년 12월 23일
As per my understanding, you want to constrain the weights of a convolution2DLayer in MATLAB. You can do so by accessing the weights of a layer as shown below: -
Referring to the following resources, which might help you in resolving the issue: -
  댓글 수: 1
CHAO WANG 2021년 1월 5일
Thank you very much for your answer. It's helpful.I will try to run it on my program.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)


Help CenterFile Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by