use of com.simiacryptus.mindseye.layers.cudnn.ImgConcatLayer in project MindsEye by SimiaCryptus.
the class RescaledSubnetLayer method eval.
@Nullable
@Override
public Result eval(@Nonnull final Result... inObj) {
assert 1 == inObj.length;
final TensorList batch = inObj[0].getData();
@Nonnull final int[] inputDims = batch.getDimensions();
assert 3 == inputDims.length;
if (1 == scale)
return subnetwork.eval(inObj);
@Nonnull final PipelineNetwork network = new PipelineNetwork();
@Nullable final DAGNode condensed = network.wrap(new ImgReshapeLayer(scale, scale, false));
network.wrap(new ImgConcatLayer(), IntStream.range(0, scale * scale).mapToObj(subband -> {
@Nonnull final int[] select = new int[inputDims[2]];
for (int i = 0; i < inputDims[2]; i++) {
select[i] = subband * inputDims[2] + i;
}
return network.add(subnetwork, network.wrap(new ImgBandSelectLayer(select), condensed));
}).toArray(i -> new DAGNode[i]));
network.wrap(new ImgReshapeLayer(scale, scale, true));
Result eval = network.eval(inObj);
network.freeRef();
return eval;
}
Aggregations