keras/keras_core/layers/layer_test.py
Chen Qian eabdb87f9f Add some numpy ops (#1)
* Add numpy ops (initial batch) and some config

* Add unit test

* fix call

* Revert "fix call"

This reverts commit 6748ad183029ff4b97317b77ceed8661916bb9a0.

* full unit test coverage

* fix setup.py
2023-04-12 11:31:58 -07:00

24 lines
642 B
Python

import numpy as np
from keras_core import testing
from keras_core.engine import keras_tensor
from keras_core.layers.layer import Layer
class FunctionTest(testing.TestCase):
def test_positional_arg_error(self):
class SomeLayer(Layer):
def call(self, x, bool_arg):
if bool_arg:
return x
return x + 1
x = keras_tensor.KerasTensor(shape=(2, 3), name="x")
with self.assertRaisesRegex(
ValueError, "Only input tensors may be passed as"
):
SomeLayer()(x, True)
# This works
SomeLayer()(x, bool_arg=True)