def _blob_and_weights(net, layer_name):
    """Get the activation blob and the weights blob for the named layer
    in the Caffe network.
    """
    # Get the activation blob for this layer and its parameters
    # (weights).
    blob = net.blobs[net.top_names[layer_name][0]]
    weights = net.params[layer_name][0]
    return blob, weights