2
$\begingroup$

I've been trying to build a convolutional autoencoder with Mathematica 12.3. For this, I need to reverse the action of PoolingLayer[]. Is there any layer similar to Keras's UpSampling1D? Could, perhaps, ReplicateLayer[] be handy here?

I just found this thread that talks about implementing an upsampling operation with DeconvolutionLayer[].

$\endgroup$
2
$\begingroup$

From what I see, UpSampling1D is equivalent to:

upsampling1DLayer[size_] := 
 NetChain[{ReplicateLayer[size, -2], 
   TransposeLayer[{-2 <-> -1, -3 <-> -2}], FlattenLayer[-1], 
   TransposeLayer[{-2 <-> -1}]}]

Applying to the example shown in Keras' documentation:

di = {{{0, 1, 2}, {3, 4, 5}}, {{6, 7, 8}, {9, 10, 11}}}
upsampling1DLayer[2]@di

{{{0., 1., 2.}, {0., 1., 2.}, {3., 4., 5.}, {3., 4., 5.}}, {{6., 7., 8.}, {6., 7., 8.}, {9., 10., 11.}, {9., 10., 11.}}}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.