idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
400
private int [ ] convertBatch ( int [ ] batch ) { int [ ] conv = new int [ batch . length ] ; for ( int i = 0 ; i < batch . length ; i ++ ) { conv [ i ] = sample [ batch [ i ] ] ; } return conv ; }
Converts a batch indexing into the sample to a batch indexing into the original function .
401
public static boolean containsAtLeastOneNonBlank ( List < String > list ) { for ( String str : list ) { if ( StringUtils . isNotBlank ( str ) ) { return true ; } } return false ; }
Check that a list allowing null and empty item contains at least one element that is not blank .
402
public static List < Integer > toIntegerList ( List < String > strList , boolean failOnException ) { List < Integer > intList = new ArrayList < Integer > ( ) ; for ( String str : strList ) { try { intList . add ( Integer . parseInt ( str ) ) ; } catch ( NumberFormatException nfe ) { if ( failOnException ) { return null...
Parse a list of String into a list of Integer . If one element can not be parsed the behavior depends on the value of failOnException .
403
public static void add ( double [ ] array1 , double [ ] array2 ) { assert ( array1 . length == array2 . length ) ; for ( int i = 0 ; i < array1 . length ; i ++ ) { array1 [ i ] += array2 [ i ] ; } }
Each element of the second array is added to each element of the first .
404
public static boolean containsOnlyNull ( Object ... values ) { for ( Object o : values ) { if ( o != null ) { return false ; } } return true ; }
Check that an array only contains null elements .
405
public static boolean containsOnlyNotNull ( Object ... values ) { for ( Object o : values ) { if ( o == null ) { return false ; } } return true ; }
Check that an array only contains elements that are not null .
406
@ RequestMapping ( value = "/soy/compileJs" , method = GET ) public ResponseEntity < String > compile ( @ RequestParam ( required = false , value = "hash" , defaultValue = "" ) final String hash , @ RequestParam ( required = true , value = "file" ) final String [ ] templateFileNames , @ RequestParam ( required = false ...
An endpoint to compile an array of soy templates to JavaScript .
407
public int [ ] sampleBatchWithReplacement ( ) { int [ ] batch = new int [ batchSize ] ; for ( int i = 0 ; i < batch . length ; i ++ ) { batch [ i ] = Prng . nextInt ( numExamples ) ; } return batch ; }
Samples a batch of indices in the range [ 0 numExamples ) with replacement .
408
public int [ ] sampleBatchWithoutReplacement ( ) { int [ ] batch = new int [ batchSize ] ; for ( int i = 0 ; i < batch . length ; i ++ ) { if ( cur == indices . length ) { cur = 0 ; } if ( cur == 0 ) { IntArrays . shuffle ( indices ) ; } batch [ i ] = indices [ cur ++ ] ; } return batch ; }
Samples a batch of indices in the range [ 0 numExamples ) without replacement .
409
public void adjustGlassSize ( ) { if ( isGlassEnabled ( ) ) { ResizeHandler handler = getGlassResizer ( ) ; if ( handler != null ) handler . onResize ( null ) ; } }
This can be called to adjust the size of the dialog glass . It is implemented using JSNI to bypass the private keyword on the glassResizer .
410
public static Bounds getSymmetricBounds ( int dim , double l , double u ) { double [ ] L = new double [ dim ] ; double [ ] U = new double [ dim ] ; for ( int i = 0 ; i < dim ; i ++ ) { L [ i ] = l ; U [ i ] = u ; } return new Bounds ( L , U ) ; }
Gets bounds which are identical for all dimensions .
411
public static Optional < Tag > parse ( final String httpTag ) { Tag result = null ; boolean weak = false ; String internal = httpTag ; if ( internal . startsWith ( "W/" ) ) { weak = true ; internal = internal . substring ( 2 ) ; } if ( internal . startsWith ( "\"" ) && internal . endsWith ( "\"" ) ) { result = new Tag ...
Parses a tag formatted as defined by the HTTP standard .
412
public String format ( ) { if ( getName ( ) . equals ( "*" ) ) { return "*" ; } else { StringBuilder sb = new StringBuilder ( ) ; if ( isWeak ( ) ) { sb . append ( "W/" ) ; } return sb . append ( '"' ) . append ( getName ( ) ) . append ( '"' ) . toString ( ) ; } }
Returns tag formatted as an HTTP tag string .
413
public static PropertyResourceBundle getBundle ( String baseName , Locale locale ) throws UnsupportedEncodingException , IOException { InputStream is = UTF8PropertyResourceBundle . class . getResourceAsStream ( "/" + baseName + "_" + locale . toString ( ) + PROPERTIES_EXT ) ; if ( is != null ) { return new PropertyReso...
Get a PropertyResourceBundle able to read an UTF - 8 properties file .
414
public boolean minimize ( DifferentiableBatchFunction function , IntDoubleVector point ) { return minimize ( function , point , null ) ; }
Minimize the function starting at the given initial point .
415
@ SuppressWarnings ( "unchecked" ) public < T > T convertElement ( ConversionContext context , Object source , TypeReference < T > destinationType ) throws ConverterException { return ( T ) elementConverter . convert ( context , source , destinationType ) ; }
Convert element to another object given a parameterized type signature
416
public Conditionals addIfMatch ( Tag tag ) { Preconditions . checkArgument ( ! modifiedSince . isPresent ( ) , String . format ( ERROR_MESSAGE , HeaderConstants . IF_MATCH , HeaderConstants . IF_MODIFIED_SINCE ) ) ; Preconditions . checkArgument ( noneMatch . isEmpty ( ) , String . format ( ERROR_MESSAGE , HeaderConsta...
Adds tags to the If - Match header .
417
public Conditionals ifModifiedSince ( LocalDateTime time ) { Preconditions . checkArgument ( match . isEmpty ( ) , String . format ( ERROR_MESSAGE , HeaderConstants . IF_MODIFIED_SINCE , HeaderConstants . IF_MATCH ) ) ; Preconditions . checkArgument ( ! unModifiedSince . isPresent ( ) , String . format ( ERROR_MESSAGE ...
You should use the server s time here . Otherwise you might get unexpected results .
418
public Headers toHeaders ( ) { Headers headers = new Headers ( ) ; if ( ! getMatch ( ) . isEmpty ( ) ) { headers = headers . add ( new Header ( HeaderConstants . IF_MATCH , buildTagHeaderValue ( getMatch ( ) ) ) ) ; } if ( ! getNoneMatch ( ) . isEmpty ( ) ) { headers = headers . add ( new Header ( HeaderConstants . IF_...
Converts the Conditionals into real headers .
419
public Collection < QName > getPortComponentQNames ( ) { Map < String , QName > map = new HashMap < String , QName > ( ) ; for ( PortComponentMetaData pcm : portComponents ) { QName qname = pcm . getWsdlPort ( ) ; map . put ( qname . getPrefix ( ) , qname ) ; } return map . values ( ) ; }
Get the QNames of the port components to be declared in the namespaces
420
public PortComponentMetaData getPortComponentByWsdlPort ( String name ) { ArrayList < String > pcNames = new ArrayList < String > ( ) ; for ( PortComponentMetaData pc : portComponents ) { String wsdlPortName = pc . getWsdlPort ( ) . getLocalPart ( ) ; if ( wsdlPortName . equals ( name ) ) return pc ; pcNames . add ( ws...
Lookup a PortComponentMetaData by wsdl - port local part
421
public static final void setBounds ( UIObject o , Rect bounds ) { setPosition ( o , bounds ) ; setSize ( o , bounds ) ; }
Sets the bounds of a UIObject moving and sizing to match the bounds specified . Currently used for the itemhover and useful for other absolutely positioned elements .
422
public static final void setPosition ( UIObject o , Rect pos ) { Style style = o . getElement ( ) . getStyle ( ) ; style . setPropertyPx ( "left" , pos . x ) ; style . setPropertyPx ( "top" , pos . y ) ; }
Sets the position of a UIObject
423
public static final void setSize ( UIObject o , Rect size ) { o . setPixelSize ( size . w , size . h ) ; }
Sets the size of a UIObject
424
public static final boolean isInside ( int x , int y , Rect box ) { return ( box . x < x && x < box . x + box . w && box . y < y && y < box . y + box . h ) ; }
Determines if a point is inside a box .
425
public static final boolean isMouseInside ( NativeEvent event , Element element ) { return isInside ( event . getClientX ( ) + Window . getScrollLeft ( ) , event . getClientY ( ) + Window . getScrollTop ( ) , getBounds ( element ) ) ; }
Determines if a mouse event is inside a box .
426
public static final Rect getViewportBounds ( ) { return new Rect ( Window . getScrollLeft ( ) , Window . getScrollTop ( ) , Window . getClientWidth ( ) , Window . getClientHeight ( ) ) ; }
This takes into account scrolling and will be in absolute coordinates where the top left corner of the page is 0 0 but the viewport may be scrolled to something else .
427
public static final Date utc2date ( Long time ) { if ( time == null || time < 0 ) return null ; time += timezoneOffsetMillis ( new Date ( time ) ) ; return new Date ( time ) ; }
Converts a time in UTC to a gwt Date object which is in the timezone of the current browser .
428
public static final Long date2utc ( Date date ) { if ( date == null ) return null ; long time = date . getTime ( ) ; time -= timezoneOffsetMillis ( date ) ; return time ; }
Converts a gwt Date in the timezone of the current browser to a time in UTC .
429
public static FullTypeSignature getTypeSignature ( String typeSignatureString , boolean useInternalFormFullyQualifiedName ) { String key ; if ( ! useInternalFormFullyQualifiedName ) { key = typeSignatureString . replace ( '.' , '/' ) . replace ( '$' , '.' ) ; } else { key = typeSignatureString ; } FullTypeSignature typ...
get TypeSignature given the signature
430
public static FullTypeSignature getTypeSignature ( Class < ? > clazz , Class < ? > [ ] typeArgs ) { ClassTypeSignature rawClassTypeSignature = ( ClassTypeSignature ) javaTypeToTypeSignature . getTypeSignature ( clazz ) ; TypeArgSignature [ ] typeArgSignatures = new TypeArgSignature [ typeArgs . length ] ; for ( int i =...
get the TypeSignature corresponding to given class with given type arguments
431
public static OptionalString ofNullable ( ResourceKey key , String value ) { return new GenericOptionalString ( RUNTIME_SOURCE , key , value ) ; }
Returns new instance of OptionalString with given key and value
432
public Archetype parse ( String adl ) { try { return parse ( new StringReader ( adl ) ) ; } catch ( IOException e ) { throw new AssertionError ( e ) ; } }
Parses an adl source into a differential archetype .
433
@ SuppressWarnings ( { "unchecked" , "unused" } ) public static < T > T [ ] object2Array ( final Class < T > clazz , final Object obj ) { return ( T [ ] ) obj ; }
We try to convert an Object to an Array and this is not easy in Java so we need a little bit of nasty magic .
434
public void pauseUpload ( ) throws LocalOperationException { if ( state == State . UPLOADING ) { setState ( State . PAUSED ) ; executor . hardStop ( ) ; } else { throw new LocalOperationException ( "Attempt to pause upload while assembly is not uploading" ) ; } }
Pauses the file upload . This is a blocking function that would try to wait till the assembly file uploads have actually been paused if possible .
435
protected AssemblyResponse watchStatus ( ) throws LocalOperationException , RequestException { AssemblyResponse response ; do { response = getClient ( ) . getAssemblyByUrl ( url ) ; try { Thread . sleep ( 1000 ) ; } catch ( InterruptedException e ) { throw new LocalOperationException ( e ) ; } } while ( ! response . is...
Runs intermediate check on the Assembly status until it is finished executing then returns it as a response .
436
private long getTotalUploadSize ( ) throws IOException { long size = 0 ; for ( Map . Entry < String , File > entry : files . entrySet ( ) ) { size += entry . getValue ( ) . length ( ) ; } for ( Map . Entry < String , InputStream > entry : fileStreams . entrySet ( ) ) { size += entry . getValue ( ) . available ( ) ; } r...
used for upload progress
437
public static < T extends InterconnectObject > T fromJson ( String data , Class < T > clazz ) throws IOException { return InterconnectMapper . mapper . readValue ( data , clazz ) ; }
Creates an object from the given JSON data .
438
public Response save ( ) throws RequestException , LocalOperationException { Map < String , Object > templateData = new HashMap < String , Object > ( ) ; templateData . put ( "name" , name ) ; options . put ( "steps" , steps . toMap ( ) ) ; templateData . put ( "template" , options ) ; Request request = new Request ( t...
Submits the configured template to Transloadit .
439
public boolean matches ( String resourcePath ) { if ( ! valid ) { return false ; } if ( resourcePath == null ) { return acceptsContextPathEmpty ; } if ( contextPathRegex != null && ! contextPathRegex . matcher ( resourcePath ) . matches ( ) ) { return false ; } if ( contextPathBlacklistRegex != null && contextPathBlack...
Checks if this service implementation accepts the given resource path .
440
private ClassLoaderInterface getClassLoader ( ) { Map < String , Object > application = ActionContext . getContext ( ) . getApplication ( ) ; if ( application != null ) { return ( ClassLoaderInterface ) application . get ( ClassLoaderInterface . CLASS_LOADER_INTERFACE ) ; } return null ; }
this class loader interface can be used by other plugins to lookup resources from the bundles . A temporary class loader interface is set during other configuration loading as well
441
public String build ( ) { StringBuilder queryString = new StringBuilder ( ) ; for ( NameValuePair param : params ) { if ( queryString . length ( ) > 0 ) { queryString . append ( PARAM_SEPARATOR ) ; } queryString . append ( Escape . urlEncode ( param . getName ( ) ) ) ; queryString . append ( VALUE_SEPARATOR ) ; querySt...
Build query string .
442
public AssemblyResponse cancelAssembly ( String url ) throws RequestException , LocalOperationException { Request request = new Request ( this ) ; return new AssemblyResponse ( request . delete ( url , new HashMap < String , Object > ( ) ) ) ; }
cancels a running assembly .
443
public Response getTemplate ( String id ) throws RequestException , LocalOperationException { Request request = new Request ( this ) ; return new Response ( request . get ( "/templates/" + id ) ) ; }
Returns a single template .
444
public Response updateTemplate ( String id , Map < String , Object > options ) throws RequestException , LocalOperationException { Request request = new Request ( this ) ; return new Response ( request . put ( "/templates/" + id , options ) ) ; }
Updates the template with the specified id .
445
public Response deleteTemplate ( String id ) throws RequestException , LocalOperationException { Request request = new Request ( this ) ; return new Response ( request . delete ( "/templates/" + id , new HashMap < String , Object > ( ) ) ) ; }
Deletes a template .
446
public ListResponse listTemplates ( Map < String , Object > options ) throws RequestException , LocalOperationException { Request request = new Request ( this ) ; return new ListResponse ( request . get ( "/templates" , options ) ) ; }
Returns a list of all templates under the user account
447
public Response getBill ( int month , int year ) throws RequestException , LocalOperationException { Request request = new Request ( this ) ; return new Response ( request . get ( "/bill/" + year + String . format ( "-%02d" , month ) ) ) ; }
Returns the bill for the month specified .
448
@ SuppressWarnings ( "unchecked" ) public static < T > T convert ( Object fromValue , Class < T > toType ) throws TypeCastException { return convert ( fromValue , toType , ( String ) null ) ; }
Convert given value to given target
449
public SignedJWT verifyToken ( String jwtString ) throws ParseException { try { SignedJWT jwt = SignedJWT . parse ( jwtString ) ; if ( jwt . verify ( new MACVerifier ( this . jwtSharedSecret ) ) ) { return jwt ; } return null ; } catch ( JOSEException e ) { throw new RuntimeException ( "Error verifying JSON Web Token" ...
Check the given JWT
450
public void bind ( T service , Map < String , Object > props ) { synchronized ( serviceMap ) { serviceMap . put ( ServiceUtil . getComparableForServiceRanking ( props ) , service ) ; updateSortedServices ( ) ; } }
Handle bind service event .
451
public void unbind ( T service , Map < String , Object > props ) { synchronized ( serviceMap ) { serviceMap . remove ( ServiceUtil . getComparableForServiceRanking ( props ) ) ; updateSortedServices ( ) ; } }
Handle unbind service event .
452
private void updateSortedServices ( ) { List < T > copiedList = new ArrayList < T > ( serviceMap . values ( ) ) ; sortedServices = Collections . unmodifiableList ( copiedList ) ; if ( changeListener != null ) { changeListener . changed ( ) ; } }
Update list of sorted services by copying it from the array and making it unmodifiable .
453
public static < T > JacksonParser < T > json ( Class < T > contentType ) { return new JacksonParser < > ( null , contentType ) ; }
Creates typed parser
454
public void addStep ( String name , String robot , Map < String , Object > options ) { all . put ( name , new Step ( name , robot , options ) ) ; }
Adds a new step to the list of steps .
455
protected boolean determineFeatureState ( final ITemplateContext context , final IProcessableElementTag tag , final AttributeName attributeName , final String attributeValue , boolean defaultState ) { final IStandardExpressionParser expressionParser = StandardExpressions . getExpressionParser ( context . getConfigurati...
Determines the feature state
456
public void init ( Configuration configuration ) { if ( devMode && reload && ! listeningToDispatcher ) { listeningToDispatcher = true ; Dispatcher . addDispatcherListener ( this ) ; } }
Not used .
457
public void addFile ( File file ) { String name = "file" ; files . put ( normalizeDuplicateName ( name ) , file ) ; }
Adds a file to your assembly but automatically generates the field name of the file .
458
public void addFile ( InputStream inputStream ) { String name = "file" ; fileStreams . put ( normalizeDuplicateName ( name ) , inputStream ) ; }
Adds a file to your assembly but automatically genarates the name of the file .
459
public void removeFile ( String name ) { if ( files . containsKey ( name ) ) { files . remove ( name ) ; } if ( fileStreams . containsKey ( name ) ) { fileStreams . remove ( name ) ; } }
Removes file from your assembly .
460
public AssemblyResponse save ( boolean isResumable ) throws RequestException , LocalOperationException { Request request = new Request ( getClient ( ) ) ; options . put ( "steps" , steps . toMap ( ) ) ; if ( isResumable && getFilesCount ( ) > 0 ) { Map < String , String > tusOptions = new HashMap < String , String > ( ...
Submits the configured assembly to Transloadit for processing .
461
protected void processTusFiles ( String assemblyUrl ) throws IOException , ProtocolException { tusClient . setUploadCreationURL ( new URL ( getClient ( ) . getHostUrl ( ) + "/resumable/files/" ) ) ; tusClient . enableResuming ( tusURLStore ) ; for ( Map . Entry < String , File > entry : files . entrySet ( ) ) { process...
Prepares all files added for tus uploads .
462
@ SuppressWarnings ( "unchecked" ) public static < T extends Serializable > T makeClone ( T from ) { return ( T ) SerializationUtils . clone ( from ) ; }
Creates a clone using java serialization
463
private static int checkResult ( int result ) { if ( exceptionsEnabled && result != cudnnStatus . CUDNN_STATUS_SUCCESS ) { throw new CudaException ( cudnnStatus . stringFor ( result ) ) ; } return result ; }
If the given result is not cudnnStatus . CUDNN_STATUS_SUCCESS and exceptions have been enabled this method will throw a CudaException with an error message that corresponds to the given result code . Otherwise the given result is simply returned .
464
public static int cudnnSetTensor4dDescriptorEx ( cudnnTensorDescriptor tensorDesc , int dataType , int n , int c , int h , int w , int nStride , int cStride , int hStride , int wStride ) { return checkResult ( cudnnSetTensor4dDescriptorExNative ( tensorDesc , dataType , n , c , h , w , nStride , cStride , hStride , wSt...
width of input section
465
public static int cudnnOpTensor ( cudnnHandle handle , cudnnOpTensorDescriptor opTensorDesc , Pointer alpha1 , cudnnTensorDescriptor aDesc , Pointer A , Pointer alpha2 , cudnnTensorDescriptor bDesc , Pointer B , Pointer beta , cudnnTensorDescriptor cDesc , Pointer C ) { return checkResult ( cudnnOpTensorNative ( handle...
B tensor is ignored for CUDNN_OP_TENSOR_SQRT CUDNN_OP_TENSOR_NOT .
466
public static int cudnnGetReductionIndicesSize ( cudnnHandle handle , cudnnReduceTensorDescriptor reduceTensorDesc , cudnnTensorDescriptor aDesc , cudnnTensorDescriptor cDesc , long [ ] sizeInBytes ) { return checkResult ( cudnnGetReductionIndicesSizeNative ( handle , reduceTensorDesc , aDesc , cDesc , sizeInBytes ) ) ...
Helper function to return the minimum size of the index space to be passed to the reduction given the input and output tensors
467
public static int cudnnGetReductionWorkspaceSize ( cudnnHandle handle , cudnnReduceTensorDescriptor reduceTensorDesc , cudnnTensorDescriptor aDesc , cudnnTensorDescriptor cDesc , long [ ] sizeInBytes ) { return checkResult ( cudnnGetReductionWorkspaceSizeNative ( handle , reduceTensorDesc , aDesc , cDesc , sizeInBytes ...
Helper function to return the minimum size of the workspace to be passed to the reduction given the input and output tensors
468
public static int cudnnReduceTensor ( cudnnHandle handle , cudnnReduceTensorDescriptor reduceTensorDesc , Pointer indices , long indicesSizeInBytes , Pointer workspace , long workspaceSizeInBytes , Pointer alpha , cudnnTensorDescriptor aDesc , Pointer A , Pointer beta , cudnnTensorDescriptor cDesc , Pointer C ) { retur...
The indices space is ignored for reduce ops other than min or max .
469
public static int cudnnGetConvolutionNdDescriptor ( cudnnConvolutionDescriptor convDesc , int arrayLengthRequested , int [ ] arrayLength , int [ ] padA , int [ ] strideA , int [ ] dilationA , int [ ] mode , int [ ] computeType ) { return checkResult ( cudnnGetConvolutionNdDescriptorNative ( convDesc , arrayLengthReques...
convolution data type
470
public static int cudnnConvolutionForward ( cudnnHandle handle , Pointer alpha , cudnnTensorDescriptor xDesc , Pointer x , cudnnFilterDescriptor wDesc , Pointer w , cudnnConvolutionDescriptor convDesc , int algo , Pointer workSpace , long workSpaceSizeInBytes , Pointer beta , cudnnTensorDescriptor yDesc , Pointer y ) {...
Function to perform the forward pass for batch convolution
471
public static int cudnnConvolutionBackwardBias ( cudnnHandle handle , Pointer alpha , cudnnTensorDescriptor dyDesc , Pointer dy , Pointer beta , cudnnTensorDescriptor dbDesc , Pointer db ) { return checkResult ( cudnnConvolutionBackwardBiasNative ( handle , alpha , dyDesc , dy , beta , dbDesc , db ) ) ; }
Function to compute the bias gradient for batch convolution
472
public static int cudnnSoftmaxForward ( cudnnHandle handle , int algo , int mode , Pointer alpha , cudnnTensorDescriptor xDesc , Pointer x , Pointer beta , cudnnTensorDescriptor yDesc , Pointer y ) { return checkResult ( cudnnSoftmaxForwardNative ( handle , algo , mode , alpha , xDesc , x , beta , yDesc , y ) ) ; }
Function to perform forward softmax
473
public static int cudnnSoftmaxBackward ( cudnnHandle handle , int algo , int mode , Pointer alpha , cudnnTensorDescriptor yDesc , Pointer y , cudnnTensorDescriptor dyDesc , Pointer dy , Pointer beta , cudnnTensorDescriptor dxDesc , Pointer dx ) { return checkResult ( cudnnSoftmaxBackwardNative ( handle , algo , mode , ...
Function to perform backward softmax
474
public static int cudnnPoolingForward ( cudnnHandle handle , cudnnPoolingDescriptor poolingDesc , Pointer alpha , cudnnTensorDescriptor xDesc , Pointer x , Pointer beta , cudnnTensorDescriptor yDesc , Pointer y ) { return checkResult ( cudnnPoolingForwardNative ( handle , poolingDesc , alpha , xDesc , x , beta , yDesc ...
Function to perform forward pooling
475
public static int cudnnPoolingBackward ( cudnnHandle handle , cudnnPoolingDescriptor poolingDesc , Pointer alpha , cudnnTensorDescriptor yDesc , Pointer y , cudnnTensorDescriptor dyDesc , Pointer dy , cudnnTensorDescriptor xDesc , Pointer x , Pointer beta , cudnnTensorDescriptor dxDesc , Pointer dx ) { return checkResu...
Function to perform backward pooling
476
public static int cudnnGetActivationDescriptor ( cudnnActivationDescriptor activationDesc , int [ ] mode , int [ ] reluNanOpt , double [ ] coef ) { return checkResult ( cudnnGetActivationDescriptorNative ( activationDesc , mode , reluNanOpt , coef ) ) ; }
ceiling for clipped RELU alpha for ELU
477
public static int cudnnActivationForward ( cudnnHandle handle , cudnnActivationDescriptor activationDesc , Pointer alpha , cudnnTensorDescriptor xDesc , Pointer x , Pointer beta , cudnnTensorDescriptor yDesc , Pointer y ) { return checkResult ( cudnnActivationForwardNative ( handle , activationDesc , alpha , xDesc , x ...
Function to perform forward activation
478
public static int cudnnActivationBackward ( cudnnHandle handle , cudnnActivationDescriptor activationDesc , Pointer alpha , cudnnTensorDescriptor yDesc , Pointer y , cudnnTensorDescriptor dyDesc , Pointer dy , cudnnTensorDescriptor xDesc , Pointer x , Pointer beta , cudnnTensorDescriptor dxDesc , Pointer dx ) { return ...
Function to perform backward activation
479
public static int cudnnLRNCrossChannelForward ( cudnnHandle handle , cudnnLRNDescriptor normDesc , int lrnMode , Pointer alpha , cudnnTensorDescriptor xDesc , Pointer x , Pointer beta , cudnnTensorDescriptor yDesc , Pointer y ) { return checkResult ( cudnnLRNCrossChannelForwardNative ( handle , normDesc , lrnMode , alp...
LRN cross - channel forward computation . Double parameters cast to tensor data type
480
public static int cudnnLRNCrossChannelBackward ( cudnnHandle handle , cudnnLRNDescriptor normDesc , int lrnMode , Pointer alpha , cudnnTensorDescriptor yDesc , Pointer y , cudnnTensorDescriptor dyDesc , Pointer dy , cudnnTensorDescriptor xDesc , Pointer x , Pointer beta , cudnnTensorDescriptor dxDesc , Pointer dx ) { r...
LRN cross - channel backward computation . Double parameters cast to tensor data type
481
public static int cudnnBatchNormalizationBackward ( cudnnHandle handle , int mode , Pointer alphaDataDiff , Pointer betaDataDiff , Pointer alphaParamDiff , Pointer betaParamDiff , cudnnTensorDescriptor xDesc , Pointer x , cudnnTensorDescriptor dyDesc , Pointer dy , cudnnTensorDescriptor dxDesc , Pointer dx , cudnnTenso...
Performs backward pass of Batch Normalization layer . Returns x gradient bnScale gradient and bnBias gradient
482
public static int cudnnRestoreDropoutDescriptor ( cudnnDropoutDescriptor dropoutDesc , cudnnHandle handle , float dropout , Pointer states , long stateSizeInBytes , long seed ) { return checkResult ( cudnnRestoreDropoutDescriptorNative ( dropoutDesc , handle , dropout , states , stateSizeInBytes , seed ) ) ; }
Restores the dropout descriptor to a previously saved - off state
483
public static int cudnnCreatePersistentRNNPlan ( cudnnRNNDescriptor rnnDesc , int minibatch , int dataType , cudnnPersistentRNNPlan plan ) { return checkResult ( cudnnCreatePersistentRNNPlanNative ( rnnDesc , minibatch , dataType , plan ) ) ; }
Expensive . Creates the plan for the specific settings .
484
public static int cudnnGetRNNWorkspaceSize ( cudnnHandle handle , cudnnRNNDescriptor rnnDesc , int seqLength , cudnnTensorDescriptor [ ] xDesc , long [ ] sizeInBytes ) { return checkResult ( cudnnGetRNNWorkspaceSizeNative ( handle , rnnDesc , seqLength , xDesc , sizeInBytes ) ) ; }
dataType in weight descriptors and input descriptors is used to describe storage
485
public static int cudnnCTCLoss ( cudnnHandle handle , cudnnTensorDescriptor probsDesc , Pointer probs , int [ ] labels , int [ ] labelLengths , int [ ] inputLengths , Pointer costs , cudnnTensorDescriptor gradientsDesc , Pointer gradients , int algo , cudnnCTCLossDescriptor ctcLossDesc , Pointer workspace , long workSp...
return the ctc costs and gradients given the probabilities and labels
486
public static int cudnnGetCTCLossWorkspaceSize ( cudnnHandle handle , cudnnTensorDescriptor probsDesc , cudnnTensorDescriptor gradientsDesc , int [ ] labels , int [ ] labelLengths , int [ ] inputLengths , int algo , cudnnCTCLossDescriptor ctcLossDesc , long [ ] sizeInBytes ) { return checkResult ( cudnnGetCTCLossWorksp...
return the workspace size needed for ctc
487
public static int cudnnGetRNNDataDescriptor ( cudnnRNNDataDescriptor RNNDataDesc , int [ ] dataType , int [ ] layout , int [ ] maxSeqLength , int [ ] batchSize , int [ ] vectorSize , int arrayLengthRequested , int [ ] seqLengthArray , Pointer paddingFill ) { return checkResult ( cudnnGetRNNDataDescriptorNative ( RNNDat...
symbol for filling padding position in output
488
public static < T > OptionalValue < T > ofNullable ( T value ) { return new GenericOptionalValue < T > ( RUNTIME_SOURCE , DEFAULT_KEY , value ) ; }
Returns new instance of OptionalValue with given value
489
public static < T > OptionalValue < T > ofNullable ( ResourceKey key , T value ) { return new GenericOptionalValue < T > ( RUNTIME_SOURCE , key , value ) ; }
Returns new instance of OptionalValue with given key and value
490
public static void stopService ( ) { DaemonStarter . currentPhase . set ( LifecyclePhase . STOPPING ) ; final CountDownLatch cdl = new CountDownLatch ( 1 ) ; Executors . newSingleThreadExecutor ( ) . execute ( ( ) -> { DaemonStarter . getLifecycleListener ( ) . stopping ( ) ; DaemonStarter . daemon . stop ( ) ; cdl . c...
Stop the service and end the program
491
private static void handleSignals ( ) { if ( DaemonStarter . isRunMode ( ) ) { try { Signal . handle ( new Signal ( "HUP" ) , arg0 -> { System . out . println ( "SIG INT" ) ; } ) ; } catch ( IllegalArgumentException e ) { System . err . println ( "Signal HUP not supported" ) ; } try { Signal . handle ( new Signal ( "TE...
I KNOW WHAT I AM DOING
492
public static void abortSystem ( final Throwable error ) { DaemonStarter . currentPhase . set ( LifecyclePhase . ABORTING ) ; try { DaemonStarter . getLifecycleListener ( ) . aborting ( ) ; } catch ( Exception e ) { DaemonStarter . rlog . error ( "Custom abort failed" , e ) ; } if ( error != null ) { DaemonStarter . rl...
Abort the daemon
493
public void initDatabase ( ) { MongoDBInit . LOGGER . info ( "initializing MongoDB" ) ; String dbName = System . getProperty ( "mongodb.name" ) ; if ( dbName == null ) { throw new RuntimeException ( "Missing database name; Set system property 'mongodb.name'" ) ; } MongoDatabase db = this . mongo . getDatabase ( dbName ...
init database with demo data
494
public static Map < String , Object > with ( Object ... params ) { Map < String , Object > map = new HashMap < > ( ) ; for ( int i = 0 ; i < params . length ; i ++ ) { map . put ( String . valueOf ( i ) , params [ i ] ) ; } return map ; }
Convenience wrapper for message parameters
495
public static ResourceResolutionContext context ( ResourceResolutionComponent [ ] components , Map < String , Object > messageParams ) { return new ResourceResolutionContext ( components , messageParams ) ; }
Build resolution context in which message will be discovered and built
496
@ Inject ( "struts.json.action.fileProtocols" ) public void setFileProtocols ( String fileProtocols ) { if ( StringUtils . isNotBlank ( fileProtocols ) ) { this . fileProtocols = TextParseUtil . commaDelimitedStringToSet ( fileProtocols ) ; } }
File URLs whose protocol are in these list will be processed as jars containing classes
497
protected boolean cannotInstantiate ( Class < ? > actionClass ) { return actionClass . isAnnotation ( ) || actionClass . isInterface ( ) || actionClass . isEnum ( ) || ( actionClass . getModifiers ( ) & Modifier . ABSTRACT ) != 0 || actionClass . isAnonymousClass ( ) ; }
Interfaces enums annotations and abstract classes cannot be instantiated .
498
protected boolean checkExcludePackages ( String classPackageName ) { if ( excludePackages != null && excludePackages . length > 0 ) { WildcardHelper wildcardHelper = new WildcardHelper ( ) ; Map < String , String > matchMap = new HashMap < String , String > ( ) ; for ( String packageExclude : excludePackages ) { int [ ...
Checks if provided class package is on the exclude list
499
protected boolean checkActionPackages ( String classPackageName ) { if ( actionPackages != null ) { for ( String packageName : actionPackages ) { String strictPackageName = packageName + "." ; if ( classPackageName . equals ( packageName ) || classPackageName . startsWith ( strictPackageName ) ) return true ; } } retur...
Checks if class package match provided list of action packages