keras-nightly 3.12.0.dev2025082503__py3-none-any.whl → 3.12.0.dev2025082603__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- keras/src/layers/reshaping/reshape.py +22 -15
- keras/src/version.py +1 -1
- {keras_nightly-3.12.0.dev2025082503.dist-info → keras_nightly-3.12.0.dev2025082603.dist-info}/METADATA +1 -1
- {keras_nightly-3.12.0.dev2025082503.dist-info → keras_nightly-3.12.0.dev2025082603.dist-info}/RECORD +6 -6
- {keras_nightly-3.12.0.dev2025082503.dist-info → keras_nightly-3.12.0.dev2025082603.dist-info}/WHEEL +0 -0
- {keras_nightly-3.12.0.dev2025082503.dist-info → keras_nightly-3.12.0.dev2025082603.dist-info}/top_level.txt +0 -0
@@ -11,13 +11,12 @@ class Reshape(Layer):
|
|
11
11
|
|
12
12
|
Args:
|
13
13
|
target_shape: Target shape. Tuple of integers, does not include the
|
14
|
-
samples dimension (batch size).
|
14
|
+
samples dimension (batch size). One element of the `target_shape`
|
15
|
+
can be -1 in which case the missing value is inferred from the
|
16
|
+
size of the array and remaining dimensions.
|
15
17
|
|
16
18
|
Input shape:
|
17
|
-
Arbitrary,
|
18
|
-
known/fixed. Use the keyword argument `input_shape` (tuple of integers,
|
19
|
-
does not include the samples/batch size axis) when using this layer as
|
20
|
-
the first layer in a model.
|
19
|
+
Arbitrary, but required to be compatible with `target_shape`.
|
21
20
|
|
22
21
|
Output shape:
|
23
22
|
`(batch_size, *target_shape)`
|
@@ -29,7 +28,7 @@ class Reshape(Layer):
|
|
29
28
|
>>> y.shape
|
30
29
|
(None, 3, 4)
|
31
30
|
|
32
|
-
>>> #
|
31
|
+
>>> # another example with shape inference using `-1` as dimension
|
33
32
|
>>> y = keras.layers.Reshape((-1, 2, 2))(x)
|
34
33
|
>>> y.shape
|
35
34
|
(None, 3, 2, 2)
|
@@ -37,7 +36,15 @@ class Reshape(Layer):
|
|
37
36
|
|
38
37
|
def __init__(self, target_shape, **kwargs):
|
39
38
|
super().__init__(**kwargs)
|
40
|
-
|
39
|
+
target_shape = tuple(target_shape)
|
40
|
+
# test validity of target_shape
|
41
|
+
if target_shape.count(-1) > 1:
|
42
|
+
raise ValueError(
|
43
|
+
"The `target_shape` argument must not contain more than one "
|
44
|
+
f"`-1` value. Received: target_shape={target_shape}"
|
45
|
+
)
|
46
|
+
self.target_shape = target_shape
|
47
|
+
self.built = True
|
41
48
|
|
42
49
|
def compute_output_shape(self, input_shape):
|
43
50
|
return (
|
@@ -53,17 +60,17 @@ class Reshape(Layer):
|
|
53
60
|
shape=output_shape, dtype=inputs.dtype, sparse=inputs.sparse
|
54
61
|
)
|
55
62
|
|
56
|
-
def
|
57
|
-
|
58
|
-
|
63
|
+
def call(self, inputs):
|
64
|
+
potentially_resolved_target_shape = (
|
65
|
+
operation_utils.compute_reshape_output_shape(
|
66
|
+
tuple(inputs.shape)[1:], self.target_shape, "target_shape"
|
67
|
+
)
|
59
68
|
)
|
60
|
-
|
61
|
-
-1 if d is None else d for d in
|
69
|
+
potentially_resolved_target_shape = tuple(
|
70
|
+
-1 if d is None else d for d in potentially_resolved_target_shape
|
62
71
|
)
|
63
|
-
|
64
|
-
def call(self, inputs):
|
65
72
|
return ops.reshape(
|
66
|
-
inputs, (ops.shape(inputs)[0],) +
|
73
|
+
inputs, (ops.shape(inputs)[0],) + potentially_resolved_target_shape
|
67
74
|
)
|
68
75
|
|
69
76
|
def get_config(self):
|
keras/src/version.py
CHANGED
{keras_nightly-3.12.0.dev2025082503.dist-info → keras_nightly-3.12.0.dev2025082603.dist-info}/RECORD
RENAMED
@@ -126,7 +126,7 @@ keras/regularizers/__init__.py,sha256=542Shphw7W8h4Dyf2rmqMKUECVZ8IVBvN9g1LWhz-b
|
|
126
126
|
keras/saving/__init__.py,sha256=KvL2GZxjvgFgEhvEnkvqjIR9JSNHKz-NWZacXajsjLI,1298
|
127
127
|
keras/src/__init__.py,sha256=Gi4S7EiCMkE03PbdGNpFdaUYySWDs_FcAJ8Taz9Y1BE,684
|
128
128
|
keras/src/api_export.py,sha256=gXOkBOnmscV013WAc75lc4Up01-Kkg9EylIAT_QWctg,1173
|
129
|
-
keras/src/version.py,sha256=
|
129
|
+
keras/src/version.py,sha256=5qtxNmOZ5WnYdRVIC5uk0hcrq7HL9pPmEMCb_9CGGHM,204
|
130
130
|
keras/src/activations/__init__.py,sha256=0nL3IFDB9unlrMz8ninKOWo-uCHasTUpTo1tXZb2u44,4433
|
131
131
|
keras/src/activations/activations.py,sha256=mogPggtp4CGldI3VOPNmesRxp6EbiR1_i4KLGaVwzL8,17614
|
132
132
|
keras/src/applications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -425,7 +425,7 @@ keras/src/layers/reshaping/cropping3d.py,sha256=Hm176o-duFkIXiAYjvjRAY6mWypY_vSE
|
|
425
425
|
keras/src/layers/reshaping/flatten.py,sha256=enyah_80RbzDFIHsa9nDvKDl0vfPMSfhwuOhpkwyUpI,3212
|
426
426
|
keras/src/layers/reshaping/permute.py,sha256=F3BxIPmPBnQGSmK2CxW4udFRRAuGKuZaomt-C2luUTs,2090
|
427
427
|
keras/src/layers/reshaping/repeat_vector.py,sha256=Gv8DRO145ooHBriDLvzitmKQJtx-ek0o7EPStPx_Pac,1335
|
428
|
-
keras/src/layers/reshaping/reshape.py,sha256=
|
428
|
+
keras/src/layers/reshaping/reshape.py,sha256=uepx-x-FGYYBXxE-SLQ0EYRiNxEyN4BZoA6bDyOn-BY,2650
|
429
429
|
keras/src/layers/reshaping/up_sampling1d.py,sha256=xJUqfpYUyc9x461UV_TMPDaCcy1_whKAknIHLkCcbhI,1591
|
430
430
|
keras/src/layers/reshaping/up_sampling2d.py,sha256=Q0YnAVgFQa2Wj1O2_kLPre0CBF9qg53yMRpDxRklzI4,6143
|
431
431
|
keras/src/layers/reshaping/up_sampling3d.py,sha256=nlK1wE5UCuTUsCGJKYkZixOGvxVE20f-H26hTnCyUU4,4910
|
@@ -597,7 +597,7 @@ keras/utils/bounding_boxes/__init__.py,sha256=jtvQll4u8ZY0Z96HwNhP1nxWEG9FM3gI-6
|
|
597
597
|
keras/utils/legacy/__init__.py,sha256=oSYZz6uS8UxSElRaaJYWJEoweJ4GAasZjnn7fNaOlog,342
|
598
598
|
keras/visualization/__init__.py,sha256=UKWmiy6sps4SWlmQi9WX8_Z53cPpLlphz2zIeHdwJpQ,722
|
599
599
|
keras/wrappers/__init__.py,sha256=QkS-O5K8qGS7C3sytF8MpmO6PasATpNVGF8qtb7Ojsw,407
|
600
|
-
keras_nightly-3.12.0.
|
601
|
-
keras_nightly-3.12.0.
|
602
|
-
keras_nightly-3.12.0.
|
603
|
-
keras_nightly-3.12.0.
|
600
|
+
keras_nightly-3.12.0.dev2025082603.dist-info/METADATA,sha256=TxxllpHfFQEkuyfpudFgtxRNMvna-9yuSVY5a0Vz9is,5970
|
601
|
+
keras_nightly-3.12.0.dev2025082603.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
602
|
+
keras_nightly-3.12.0.dev2025082603.dist-info/top_level.txt,sha256=ptcw_-QuGZ4ZDjMdwi_Z0clZm8QAqFdvzzFnDEOTs9o,6
|
603
|
+
keras_nightly-3.12.0.dev2025082603.dist-info/RECORD,,
|
{keras_nightly-3.12.0.dev2025082503.dist-info → keras_nightly-3.12.0.dev2025082603.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|