我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用keras.constraints.nonneg()。
def test_nonneg(): nonneg_instance = constraints.nonneg() normed = nonneg_instance(K.variable(example_array)) assert(np.all(np.min(K.eval(normed), axis=1) == 0.))
def test_nonneg(self): from keras.constraints import nonneg nonneg_instance = nonneg() normed = nonneg_instance(self.example_array) assert (np.all(np.min(normed.eval(), axis=1) == 0.))