Add API export decorators

This commit is contained in:
Francois Chollet 2023-05-09 13:00:17 -07:00
parent 3bf3c24aa8
commit a506d262e8
5 changed files with 16 additions and 2 deletions

@ -2,10 +2,12 @@ import math
from keras_core import backend
from keras_core import operations as ops
from keras_core.api_export import keras_core_export
from keras_core.layers.input_spec import InputSpec
from keras_core.layers.layer import Layer
@keras_core_export("keras_core.layers.Flatten")
class Flatten(Layer):
"""Flattens the input. Does not affect the batch size.

@ -1,8 +1,10 @@
from keras_core import operations as ops
from keras_core.api_export import keras_core_export
from keras_core.layers.input_spec import InputSpec
from keras_core.layers.layer import Layer
@keras_core_export("keras_core.layers.Permute")
class Permute(Layer):
"""Permutes the dimensions of the input according to a given pattern.
@ -13,8 +15,10 @@ class Permute(Layer):
batch dimension. Indexing starts at 1.
For instance, `(2, 1)` permutes the first and second dimensions
of the input.
Input shape:
Arbitrary.
Output shape:
Same as the input shape, but with the dimensions re-ordered according
to the specified pattern.

@ -1,8 +1,10 @@
from keras_core import operations as ops
from keras_core.api_export import keras_core_export
from keras_core.layers.input_spec import InputSpec
from keras_core.layers.layer import Layer
@keras_core_export("keras_core.layers.RepeatVector")
class RepeatVector(Layer):
"""Repeats the input n times.
@ -15,10 +17,12 @@ class RepeatVector(Layer):
Args:
n: Integer, repetition factor.
Input shape:
2D tensor of shape `(batch_size, features)`.
2D tensor with shape `(batch_size, features)`.
Output shape:
3D tensor of shape `(batch_size, n, features)`.
3D tensor with shape `(batch_size, n, features)`.
"""
def __init__(self, n, name=None, dtype=None):

@ -1,8 +1,10 @@
from keras_core import operations as ops
from keras_core.api_export import keras_core_export
from keras_core.layers.layer import Layer
from keras_core.operations import operation_utils
@keras_core_export("keras_core.layers.Reshape")
class Reshape(Layer):
"""Layer that reshapes inputs into the given shape.

@ -1,8 +1,10 @@
from keras_core import operations as ops
from keras_core.api_export import keras_core_export
from keras_core.layers.input_spec import InputSpec
from keras_core.layers.layer import Layer
@keras_core_export("keras_core.layers.UpSampling1D")
class UpSampling1D(Layer):
"""Upsampling layer for 1D inputs.