/** * Out. * * @param fmt the fmt * @param args the args */ default void out(final CharSequence fmt, final Object... args) { p(fmt, args); }
/** * Print sample. * * @param log the log * @param expanded the expanded * @param size the size */ public static void printSample(@Nonnull final NotebookOutput log, final Tensor[][] expanded, final int size) { @Nonnull final ArrayList<Tensor[]> list = new ArrayList<>(Arrays.asList(expanded)); Collections.shuffle(list); log.p("Expanded Training Data Sample: " + list.stream().limit(size).map(x -> { return log.png(x[0].toGrayImage(), ""); }).reduce((a, b) -> a + b).get()); }
/** * Out. * * @param fmt the fmt * @param args the args */ default void out(final CharSequence fmt, final Object... args) { p(fmt, args); }
/** * Print sample. * * @param log the log * @param expanded the expanded * @param size the size */ public static void printSample(@Nonnull final NotebookOutput log, final Tensor[][] expanded, final int size) { @Nonnull final ArrayList<Tensor[]> list = new ArrayList<>(Arrays.asList(expanded)); Collections.shuffle(list); log.p("Expanded Training Data Sample: " + list.stream().limit(size).map(x -> { return log.png(x[0].toGrayImage(), ""); }).reduce((a, b) -> a + b).get()); }
/** * Write gif. * * @param log the logger * @param imageStream the png stream */ public static void writeGif(@Nonnull final NotebookOutput log, final Stream<BufferedImage> imageStream) { BufferedImage[] imgs = imageStream.toArray(i -> new BufferedImage[i]); log.p("Animated Sequence:"); log.p(animatedGif(log, imgs)); }
/** * Print sample. * * @param log the log * @param expanded the expanded * @param size the size */ public static void printSample(@Nonnull final NotebookOutput log, final Tensor[][] expanded, final int size) { @Nonnull final ArrayList<Tensor[]> list = new ArrayList<>(Arrays.asList(expanded)); Collections.shuffle(list); log.p("Expanded Training Data Sample: " + list.stream().limit(size).map(x -> { return log.png(x[0].toGrayImage(), ""); }).reduce((a, b) -> a + b).get()); }
/** * Write gif. * * @param log the logger * @param imageStream the png stream */ public static void writeGif(@Nonnull final NotebookOutput log, final Stream<BufferedImage> imageStream) { BufferedImage[] imgs = imageStream.toArray(i -> new BufferedImage[i]); log.p("Animated Sequence:"); log.p(animatedGif(log, imgs)); }
/** * Write gif. * * @param log the logger * @param imageStream the png stream */ public static void writeGif(@Nonnull final NotebookOutput log, final Stream<BufferedImage> imageStream) { BufferedImage[] imgs = imageStream.toArray(i -> new BufferedImage[i]); log.p("Animated Sequence:"); log.p(animatedGif(log, imgs)); }
/** * Test tolerance statistics. * * @param output * @param subject the subject * @param inputPrototype the input prototype * @return the tolerance statistics */ @Override public ToleranceStatistics test(@Nonnull final NotebookOutput output, final Layer subject, @Nonnull final Tensor... inputPrototype) { output.h1("Reference Implementation"); output.p("This key is an alternate implementation which is expected to behave the same as the following key:"); output.run(() -> { log.info(new GsonBuilder().setPrettyPrinting().create().toJson(reference.getJson())); }); output.p("We measureStyle the agreement between the two layers in a random execution:"); return output.eval(() -> { return test(subject, inputPrototype); }); }
/** * Test tolerance statistics. * * @param output * @param subject the subject * @param inputPrototype the input prototype * @return the tolerance statistics */ @Override public ToleranceStatistics test(@Nonnull final NotebookOutput output, final Layer subject, @Nonnull final Tensor... inputPrototype) { output.h1("Reference Implementation"); output.p("This layer is an alternate implementation which is expected to behave the same as the following layer:"); output.run(() -> { log.info(new GsonBuilder().setPrettyPrinting().create().toJson(reference.getJson())); }); output.p("We measureStyle the agreement between the two layers in a random execution:"); return output.eval(() -> { return test(subject, inputPrototype); }); }
/** * Test tolerance statistics. * * @param output * @param subject the subject * @param inputPrototype the input prototype * @return the tolerance statistics */ @Override public ToleranceStatistics test(@Nonnull final NotebookOutput output, final Layer subject, @Nonnull final Tensor... inputPrototype) { output.h1("Reference Implementation"); output.p("This key is an alternate implementation which is expected to behave the same as the following key:"); output.run(() -> { log.info(new GsonBuilder().setPrettyPrinting().create().toJson(reference.getJson())); }); output.p("We measureStyle the agreement between the two layers in a random execution:"); return output.eval(() -> { return test(subject, inputPrototype); }); }
/** * Test tolerance statistics. * * @param log * @param reference the reference * @param inputPrototype the input prototype * @return the tolerance statistics */ @Override public ToleranceStatistics test(@Nonnull final NotebookOutput log, final Layer reference, @Nonnull final Tensor... inputPrototype) { log.h1("Batch Execution"); log.p("Most layers, including this one, should behave the same no matter how the items are split between batches. We verify this:"); return log.eval(() -> { return test(reference, inputPrototype); }); }
/** * Test tolerance statistics. * * @param log * @param reference the reference * @param inputPrototype the input prototype * @return the tolerance statistics */ @Override public ToleranceStatistics test(@Nonnull final NotebookOutput log, final Layer reference, @Nonnull final Tensor... inputPrototype) { log.h1("Batch Execution"); log.p("Most layers, including this one, should behave the same no matter how the items are split between batches. We verify this:"); return log.eval(() -> { return test(reference, inputPrototype); }); }
/** * Test tolerance statistics. * * @param log * @param reference the reference * @param inputPrototype the input prototype * @return the tolerance statistics */ @Override public ToleranceStatistics test(@Nonnull final NotebookOutput log, final Layer reference, @Nonnull final Tensor... inputPrototype) { log.h1("Batch Execution"); log.p("Most layers, including this one, should behave the same no matter how the items are split between batches. We verify this:"); return log.eval(() -> { return test(reference, inputPrototype); }); }
/** * Print header. * * @param log the log */ public void printHeader(@Nonnull NotebookOutput log) { log.setFrontMatterProperty("created_on", new Date().toString()); log.setFrontMatterProperty("report_type", getReportType().name()); @Nullable CharSequence targetJavadoc = printHeader(log, getTargetClass(), "network"); @Nullable CharSequence reportJavadoc = printHeader(log, getReportClass(), "report"); // log.p("__Target Description:__ " + StringEscapeUtils.escapeHtml4(targetJavadoc)); // log.p("__Report Description:__ " + StringEscapeUtils.escapeHtml4(reportJavadoc)); log.p("__Target Description:__ " + targetJavadoc); log.p("__Report Description:__ " + reportJavadoc); }
/** * Print header. * * @param log the log */ public void printHeader(@Nonnull NotebookOutput log) { log.setFrontMatterProperty("created_on", new Date().toString()); log.setFrontMatterProperty("report_type", getReportType().name()); @Nullable CharSequence targetJavadoc = printHeader(log, getTargetClass(), "network"); @Nullable CharSequence reportJavadoc = printHeader(log, getReportClass(), "report"); // log.p("__Target Description:__ " + StringEscapeUtils.escapeHtml4(targetJavadoc)); // log.p("__Report Description:__ " + StringEscapeUtils.escapeHtml4(reportJavadoc)); log.p("__Target Description:__ " + targetJavadoc); log.p("__Report Description:__ " + reportJavadoc); }
/** * Print header. * * @param log the log */ public void printHeader(@Nonnull NotebookOutput log) { log.setFrontMatterProperty("created_on", new Date().toString()); log.setFrontMatterProperty("report_type", getReportType().name()); @Nullable CharSequence targetJavadoc = printHeader(log, getTargetClass(), "network"); @Nullable CharSequence reportJavadoc = printHeader(log, getReportClass(), "report"); // log.p("__Target Description:__ " + StringEscapeUtils.escapeHtml4(targetJavadoc)); // log.p("__Report Description:__ " + StringEscapeUtils.escapeHtml4(reportJavadoc)); log.p("__Target Description:__ " + targetJavadoc); log.p("__Report Description:__ " + reportJavadoc); }
/** * Test. * @param log * @param component the component * @param inputPrototype the input prototype */ @Nullable @Override public ToleranceStatistics test(@Nonnull final NotebookOutput log, final Layer component, @Nonnull final Tensor... inputPrototype) { log.h1("Performance"); if (component instanceof DAGNetwork) { TestUtil.instrumentPerformance((DAGNetwork) component); } log.p("Now we execute larger-scale runs to benchmark performance:"); log.run(() -> { test(component, inputPrototype); }); if (component instanceof DAGNetwork) { TestUtil.extractPerformance(log, (DAGNetwork) component); } return null; }
/** * Test. * @param log * @param component the component * @param inputPrototype the input prototype */ @Nullable @Override public ToleranceStatistics test(@Nonnull final NotebookOutput log, final Layer component, @Nonnull final Tensor... inputPrototype) { log.h1("Performance"); if (component instanceof DAGNetwork) { TestUtil.instrumentPerformance((DAGNetwork) component); } log.p("Now we execute larger-scale runs to benchmark performance:"); log.run(() -> { test(component, inputPrototype); }); if (component instanceof DAGNetwork) { TestUtil.extractPerformance(log, (DAGNetwork) component); } return null; }
/** * Test. * * @param log * @param component the component * @param inputPrototype the input prototype */ @Nullable @Override public ToleranceStatistics test(@Nonnull final NotebookOutput log, final Layer component, @Nonnull final Tensor... inputPrototype) { log.h1("Performance"); if (component instanceof DAGNetwork) { TestUtil.instrumentPerformance((DAGNetwork) component); } log.p("Now we execute larger-scale runs to benchmark performance:"); log.run(() -> { test(component, inputPrototype); }); if (component instanceof DAGNetwork) { TestUtil.extractPerformance(log, (DAGNetwork) component); } return null; }