Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Extends PR #1376 -- merge that first.
Fixes #949
Possible resolves #1386, subject to discussion.
CVAE
generate()
accepts an optionallatentVector
(inspired by DCGAN).[undefined, undefined]
.[1, 16]
as this will vary based on the model. Accesses the input shape by looking at the model instead.this.labelVector
andthis.latentDim
. These are now local variables ingenerate()
.tf.oneHot()
to encode the label input.squeeze()
instead of verbose.reshape([temp.shape[1], temp.shape[2], temp.shape[3]])
raw
instead ofraws
to match other models. Now returns both to be non-breaking.generateInternal()
as an IIFE inside ofgenerate()
so that I didn't need to duplicate the JSDoc.DCGAN
model.json
or amanifest.json
, since the manifest does not provide any necessary info. (see issue Discussion: does DCGAN really need a manifest.json? #1386)generate()
can accept both acallback
and alatentVector
with both optional and in any order. Callbacks should always be last so the way that we had it did not make sense.generate()
,generateInternal()
andcompute()
into one method.compute()
into a utility.tensorInput
modelInputShape
figures out the correct tensor shape based on the model. This is really important and should be used in a few other models as well. Having hard-coded variables likeIMAGE_SIZE
will not work if the user provides a URL to a custom model which uses a different input size than what is expected by the code.layerIndex
allows this to work for models likeCVAE
which take an array of tensors instead of a single tensor input.validateLatentInput
includes the existing logic which I removed fromDCGAN.compute()
for creating either a random input tensor or a tensor from a provided array.Failed Tests
There are 2 failures in the new tests that I've added:
manifest.json
does not work due to the relative URL issue discussed in Discussion: does DCGAN really need a manifest.json? #1386p5Utils.setP5Instance()
does not work as intended. I believe that there is an issue in theP5Util
class.