Skip to content

Commit 4801fc3

Browse files
committed
add tf.map_fn
1 parent 5dca5bd commit 4801fc3

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

stubs/tensorflow/tensorflow/__init__.pyi

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ from tensorflow._aliases import (
2929
RaggedTensorLike,
3030
ScalarTensorCompatible,
3131
ShapeLike,
32+
Signature,
3233
Slice,
3334
SparseTensorCompatible,
3435
TensorCompatible,
@@ -442,6 +443,17 @@ def ones_like(
442443
) -> RaggedTensor: ...
443444

444445
def reshape(tensor: TensorCompatible, shape: ShapeLike | Tensor, name: str | None = None) -> Tensor: ...
446+
def map_fn(
447+
fn: Callable[TensorLike | TensorCompatible, TensorLike],
448+
elems: TensorLike | TensorCompatible,
449+
dtype: DTypeLike | None = None,
450+
parallel_iterations: int | None = None,
451+
back_prop: bool = True,
452+
swap_memory: bool = False,
453+
infer_shape: bool = True,
454+
name: str | None = None,
455+
fn_output_signature: Signature = None,
456+
) -> Tensor: ...
445457
def pad(
446458
tensor: TensorCompatible,
447459
paddings: Tensor | IntArray | Iterable[Iterable[int]],

stubs/tensorflow/tensorflow/_aliases.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ TensorOrArray: TypeAlias = tf.Tensor | AnyArray
5656

5757
ShapeLike: TypeAlias = tf.TensorShape | Iterable[ScalarTensorCompatible | None] | int | tf.Tensor
5858
DTypeLike: TypeAlias = DType | str | np.dtype[Any] | int
59+
Signature: DType | tf.RaggedTensorSpec | tf.SparseTensorSpec | Sequence[Signature]
5960

6061
ContainerTensors: TypeAlias = ContainerGeneric[tf.Tensor]
6162
ContainerTensorsLike: TypeAlias = ContainerGeneric[TensorLike]

0 commit comments

Comments
 (0)