<s> from layer import * <EOL> class CosLayer ( Layer ) : <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> super ( CosLayer , self ) . __init__ ( * args , ** kwargs ) <EOL> @ classmethod <EOL> def IsLayerType ( cls , proto ) : <EOL> return proto . hyperparams . activation == deepnet_pb2 . Hyperparams . COS <EOL> def ApplyActivation ( self ) : <EOL> self . backup_state . assign ( self . state ) <EOL> cm . cos ( self . state ) <EOL> def ComputeDeriv ( self ) : <EOL> """<STR_LIT>""" <EOL> self . deriv . apply_cos_deriv ( self . backup_state ) <EOL> def AllocateBatchsizeDependentMemory ( self , batchsize ) : <EOL> super ( CosLayer , self ) . AllocateBatchsizeDependentMemory ( batchsize ) <EOL> self . backup_state = cm . CUDAMatrix ( np . zeros ( self . statesize . shape ) ) </s>
