<commit_before>import numpy as np
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn


fX = theano.config.floatX


@treeano.register_node("spatial_feature_point")
class SpatialFeaturePointNode(treeano.NodeImpl):

    """
    extracts expected feature points from input spatial tensor
    (assumes that the input tensor has been converted into a probability
    distribution over locations - eg. through a spatial softmax)

    based on feature point layer from
    "End-to-End Training of Deep Visuomotor Policies"
    http://arxiv.org/abs/1504.00702
    """

    def compute_output(self, network, in_vw):
        # assumes dim 0 is batch dim and dim 1 is channel dim
        num_spatial_dims = in_vw.ndim - 2
        # output has shape (batch_size, num_channels, num_dims)<commit_msg>add note re: spatial soft argmax<commit_after>import numpy as np
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn


fX = theano.config.floatX


@treeano.register_node("spatial_feature_point")
class SpatialFeaturePointNode(treeano.NodeImpl):

    """
    extracts expected feature points from input spatial tensor
    (assumes that the input tensor has been converted into a probability
    distribution over locations - eg. through a spatial softmax)

    based on feature point layer from
    "End-to-End Training of Deep Visuomotor Policies"
    http://arxiv.org/abs/1504.00702

    combined with spatial softmax results in something referred to as
    a "spatial soft argmax"
    """

    def compute_output(self, network, in_vw):
        # assumes dim 0 is batch dim and dim 1 is channel dim
        num_spatial_dims = in_vw.ndim - 2
        # output has shape (batch_size, num_channels, num_dims)
{'fraction_non_alphanumeric': 0.062285714285714285, 'fraction_numerical': 0.013714285714285714, 'mean_word_length': 3.548051948051948, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2482798', 'n_tokens_mistral': 539, 'n_tokens_neox': 504, 'n_words': 190}