caffeinterface
Class CaffeComputeRpc

java.lang.Object
  extended by protobuf.ComputeServiceProtos.Compute
      extended by caffeinterface.CaffeComputeRpc
All Implemented Interfaces:
com.google.protobuf.Service

public class CaffeComputeRpc
extends ComputeServiceProtos.Compute

Provides a Service that serves CAFFE classes. Moreover, has methods to convert between the ComputeServiceProtos.Matrix class defined as a protocol buffer for data transfer, and colt matrices.

Author:
dgorur

Nested Class Summary
 
Nested classes/interfaces inherited from class protobuf.ComputeServiceProtos.Compute
ComputeServiceProtos.Compute.Stub
 
Constructor Summary
CaffeComputeRpc()
           
 
Method Summary
 void compute(com.google.protobuf.RpcController controller, ComputeServiceProtos.Matrix request, com.google.protobuf.RpcCallback<ComputeServiceProtos.Matrix> done)
          Converts the given ComputeServiceProtos.Matrix into a DoubleMatrix2D, then invokes the CaffeToVectorFunction served by this service on the result.
 CaffeToVectorFunction getVectorFunction()
          Returns the CaffeToVectorFunction provided by this service.
static cern.colt.matrix.DoubleMatrix2D makeDoubleMatrix(ComputeServiceProtos.Matrix request)
          Converts the given protocol buffer ComputeServiceProtos.Matrix into a DoubleMatrix2D in colt.
static ComputeServiceProtos.Matrix makeProtoMatrix(cern.colt.matrix.DoubleMatrix2D outputs)
          Converts a colt DoubleMatrix2D into a protocol buffer ComputeServiceProtos.Matrix.
 void setVectorFunction(CaffeToVectorFunction vectorFunction)
          Sets the CaffeToVectorFunction to be provided by this service.
 
Methods inherited from class protobuf.ComputeServiceProtos.Compute
callMethod, getDescriptor, getDescriptorForType, getRequestPrototype, getResponsePrototype, newStub
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CaffeComputeRpc

public CaffeComputeRpc()
Method Detail

makeDoubleMatrix

public static cern.colt.matrix.DoubleMatrix2D makeDoubleMatrix(ComputeServiceProtos.Matrix request)
Converts the given protocol buffer ComputeServiceProtos.Matrix into a DoubleMatrix2D in colt.

Parameters:
request - the given ComputeServiceProtos.Matrix.
Returns:
the equivalent DoubleMatrix2D

makeProtoMatrix

public static ComputeServiceProtos.Matrix makeProtoMatrix(cern.colt.matrix.DoubleMatrix2D outputs)
Converts a colt DoubleMatrix2D into a protocol buffer ComputeServiceProtos.Matrix.

Parameters:
outputs - the given DoubleMatrix2D.
Returns:
the equivalent ComputeServiceProtos.Matrix.

compute

public void compute(com.google.protobuf.RpcController controller,
                    ComputeServiceProtos.Matrix request,
                    com.google.protobuf.RpcCallback<ComputeServiceProtos.Matrix> done)
Converts the given ComputeServiceProtos.Matrix into a DoubleMatrix2D, then invokes the CaffeToVectorFunction served by this service on the result. Finally calls the done method passed in.

Specified by:
compute in class ComputeServiceProtos.Compute
See Also:
ComputeServiceProtos.Compute.compute(com.google.protobuf.RpcController, protobuf.ComputeServiceProtos.Matrix, com.google.protobuf.RpcCallback)

getVectorFunction

public CaffeToVectorFunction getVectorFunction()
Returns the CaffeToVectorFunction provided by this service.

Returns:
the CaffeToVectorFunction provided by this service.

setVectorFunction

public void setVectorFunction(CaffeToVectorFunction vectorFunction)
Sets the CaffeToVectorFunction to be provided by this service.

Parameters:
vectorFunction - the given vectorFunction.