本文整理了Java中com.simiacryptus.util.Util
类的一些代码示例,展示了Util
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util
类的具体详情如下:
包路径:com.simiacryptus.util.Util
类名称:Util
[英]The type Util.
[中]类型为Util。
代码示例来源:origin: com.simiacryptus/mindseye
/**
* Add weights bias layer.
*
* @param f the f
* @return the bias layer
*/
@Nonnull
public BiasLayer addWeights(@Nonnull final DoubleSupplier f) {
Util.add(f, bias);
return this;
}
代码示例来源:origin: com.simiacryptus/java-util
/**
* Cache input stream.
*
* @param url the url
* @return the input stream
* @throws IOException the io exception
* @throws NoSuchAlgorithmException the no such algorithm exception
* @throws KeyManagementException the key management exception
*/
public static InputStream cacheStream(@javax.annotation.Nonnull final URI url) throws IOException, NoSuchAlgorithmException, KeyManagementException {
return com.simiacryptus.util.Util.cacheStream(url.toString(), new File(url.getPath()).getName());
}
代码示例来源:origin: com.simiacryptus/mindseye
/**
* Gets test report location.
*
* @param sourceClass the source class
* @param suffix the suffix
* @return the test report location
*/
@Nonnull
public static File getTestReportLocation(@Nonnull final Class<?> sourceClass, @Nonnull final CharSequence... suffix) {
final StackTraceElement callingFrame = Thread.currentThread().getStackTrace()[2];
final CharSequence methodName = callingFrame.getMethodName();
final String className = sourceClass.getCanonicalName();
String classFilename = className.replaceAll("\\.", "/").replaceAll("\\$", "/");
@Nonnull File path = new File(Util.mkString(File.separator, "reports", classFilename));
for (int i = 0; i < suffix.length - 1; i++) path = new File(path, suffix[i].toString());
String testName = suffix.length == 0 ? String.valueOf(methodName) : suffix[suffix.length - 1].toString();
File parent = path;
//parent = new File(path, new SimpleDateFormat("yyyy-MM-dd_HHmmss").format(new Date()));
path = new File(parent, testName + ".md");
path.getParentFile().mkdirs();
logger.info(String.format("Output Location: %s", path.getAbsoluteFile()));
return path;
}
代码示例来源:origin: com.simiacryptus/java-util
/**
* Cache input stream.
*
* @param file the file
* @param url the url
* @return the input stream
* @throws IOException the io exception
*/
public static InputStream cacheLocal(String file, URI url) throws IOException {
return cacheLocal(file, getStreamSupplier(url));
}
代码示例来源:origin: com.simiacryptus/literate-reporting
/**
* Code file string.
*
* @param file the file
* @return the string
*/
public CharSequence pathTo(@javax.annotation.Nonnull File file) {
return stripPrefix(Util.toString(pathToFile(getReportFile(), file)), "/");
}
代码示例来源:origin: com.simiacryptus/java-util
escape = true;//
} else if (eval instanceof Component) {
str = png(Util.toImage((Component) eval), "Result");
escape = false;
} else if (eval instanceof BufferedImage) {
代码示例来源:origin: com.simiacryptus/mindseye-test
} catch (RuntimeException e) {
e.printStackTrace();
Util.sleep(1000);
} catch (OutOfMemoryError e) {
e.printStackTrace();
Util.sleep(1000);
代码示例来源:origin: com.simiacryptus/mindseye-research
/**
* Sets timeout.
*
* @param number the number
* @param units the units
* @return the timeout
*/
@Nonnull
public LayerRateDiagnosticTrainer setTimeout(final int number, @Nonnull final TimeUnit units) {
return setTimeout(number, Util.cvt(units));
}
代码示例来源:origin: com.simiacryptus/java-util
/**
* Cache file file.
*
* @param url the url
* @return the file
* @throws IOException the io exception
* @throws NoSuchAlgorithmException the no such algorithm exception
* @throws KeyManagementException the key management exception
*/
public static File cacheFile(@javax.annotation.Nonnull final URI url) throws IOException, NoSuchAlgorithmException, KeyManagementException {
return com.simiacryptus.util.Util.cacheFile(url.toString(), new File(url.getPath()).getName());
}
代码示例来源:origin: com.simiacryptus/char-trie
private static void read() {
try {
InputStream in = Util.cacheLocal(file, new URI(url));
String txt = new String(IOUtils.toByteArray(in), "UTF-8").replaceAll("\r", "");
for (String paragraph : txt.split("\n\\s*\n")) {
queue.add(new Shakespeare(paragraph));
}
} catch (final IOException e) {
// Ignore... end of stream
} catch (final RuntimeException e) {
if (!(e.getCause() instanceof InterruptedException)) throw e;
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
}
代码示例来源:origin: com.simiacryptus/literate-reporting
@Override
@Nonnull
public File pngFile(@Nonnull final BufferedImage rawImage, final File file) {
@Nullable final BufferedImage stdImage = Util.maximumSize(rawImage, getMaxImageSize());
try {
if (stdImage != rawImage) {
@Nonnull final String rawName = file.getName().replace(".png", "_raw.png");
ImageIO.write(rawImage, "png", new File(file.getParent(), rawName));
}
ImageIO.write(stdImage, "png", file);
} catch (IOException e) {
throw new RuntimeException(e);
}
return file;
}
代码示例来源:origin: com.simiacryptus/literate-reporting
escape = true;//
} else if (eval instanceof Component) {
str = png(Util.toImage((Component) eval), "Result");
escape = false;
} else if (eval instanceof BufferedImage) {
代码示例来源:origin: com.simiacryptus/java-util
/**
* Code file string.
*
* @param file the file
* @return the string
*/
public CharSequence pathTo(@javax.annotation.Nonnull File file) {
return stripPrefix(Util.toString(pathToFile(getReportFile(), file)), "/");
}
代码示例来源:origin: com.simiacryptus/mindseye-labs
} catch (RuntimeException e) {
e.printStackTrace();
Util.sleep(1000);
} catch (OutOfMemoryError e) {
e.printStackTrace();
Util.sleep(1000);
代码示例来源:origin: com.simiacryptus/mindseye-research
/**
* Sets timeout.
*
* @param number the number
* @param units the units
* @return the timeout
*/
@Nonnull
public RoundRobinTrainer setTimeout(final int number, @Nonnull final TimeUnit units) {
return setTimeout(number, Util.cvt(units));
}
代码示例来源:origin: com.simiacryptus/mindseye
/**
* From s 3 vgg 16 hdf 5.
*
* @return the vgg 16 hdf 5
*/
public static ImageClassifier fromHDF5() {
try {
return fromHDF5(Util.cacheFile(TestUtil.S3_ROOT.resolve("vgg19_weights.h5")));
} catch (IOException | KeyManagementException | NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: com.simiacryptus/char-trie
private static void read() {
try {
InputStream in = Util.cacheLocal(file, new URI(url));
String txt = new String(IOUtils.toByteArray(in), "UTF-8").replaceAll("\r", "");
List<CharSequence> list = Arrays.stream(txt.split("\n")).map(x -> x.replaceAll("[^\\w]", "")).collect(Collectors.toList());
Collections.shuffle(list);
for (CharSequence paragraph : list) {
queue.add(new EnglishWords(paragraph));
}
} catch (final IOException e) {
// Ignore... end of stream
} catch (final RuntimeException e) {
if (!(e.getCause() instanceof InterruptedException)) throw e;
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
}
代码示例来源:origin: com.simiacryptus/java-util
@Override
@Nonnull
public File pngFile(@Nonnull final BufferedImage rawImage, final File file) {
@Nullable final BufferedImage stdImage = Util.maximumSize(rawImage, getMaxImageSize());
try {
if (stdImage != rawImage) {
@Nonnull final String rawName = file.getName().replace(".png", "_raw.png");
ImageIO.write(rawImage, "png", new File(file.getParent(), rawName));
}
ImageIO.write(stdImage, "png", file);
} catch (IOException e) {
throw new RuntimeException(e);
}
return file;
}
代码示例来源:origin: com.simiacryptus/mindseye-test
BufferedImage image = Util.toImage(TestUtil.plot(history));
if (null != image) ImageIO.write(image, "png", log.file(training_name));
} catch (IOException e) {
代码示例来源:origin: com.simiacryptus/mindseye-java
/**
* Add weights bias key.
*
* @param f the f
* @return the bias key
*/
@Nonnull
public BiasLayer addWeights(@Nonnull final DoubleSupplier f) {
Util.add(f, bias);
return this;
}
内容来源于网络,如有侵权,请联系作者删除!