<commit_before>#ifndef CNN_EXPR_H
#define CNN_EXPR_H

#include "cnn/cnn.h"
#include "cnn/nodes.h"

namespace cnn { namespace expr {

struct Expression {
  ComputationGraph *pg;
  VariableIndex i;

  Expression() : pg(nullptr) { }
  Expression(ComputationGraph *pg, VariableIndex i) : pg(pg), i(i) { }
  const Tensor& value() { return pg->get_value(i); }
};

Expression input(ComputationGraph& g, real s);
Expression input(ComputationGraph& g, const real *ps);
Expression input(ComputationGraph& g, const Dim& d, const std::vector<float>& data);
Expression input(ComputationGraph& g, const Dim& d, const std::vector<float>* pdata);
Expression parameter(ComputationGraph& g, Parameters* p);
Expression const_parameter(ComputationGraph& g, Parameters* p);
Expression lookup(ComputationGraph& g, LookupParameters* p, unsigned index);
Expression lookup(ComputationGraph& g, LookupParameters* p, const unsigned* pindex);
Expression const_lookup(ComputationGraph& g, LookupParameters* p, unsigned index);
Expression const_lookup(ComputationGraph& g, LookupParameters* p, const unsigned* pindex);
// Batched versions of lookup and const_lookup
Expression lookup(ComputationGraph& g, LookupParameters* p, const std::vector<unsigned>& indices);
Expression lookup(ComputationGraph& g, LookupParameters* p, const std::vector<unsigned>* pindices);
Expression const_lookup(ComputationGraph& g, LookupParameters* p, const std::vector<unsigned>& indices);
Expression const_lookup(ComputationGraph& g, LookupParameters* p, const std::vector<unsigned>* pindices);
Expression zeroes(ComputationGraph& g, const Dim& d);

Expression operator-(const Expression& x);
Expression operator+(const Expression& x, const Expression& y);<commit_msg>Added const to expression value getter<commit_after>#ifndef CNN_EXPR_H
#define CNN_EXPR_H

#include "cnn/cnn.h"
#include "cnn/nodes.h"

namespace cnn { namespace expr {

struct Expression {
  ComputationGraph *pg;
  VariableIndex i;

  Expression() : pg(nullptr) { }
  Expression(ComputationGraph *pg, VariableIndex i) : pg(pg), i(i) { }
  const Tensor& value() const { return pg->get_value(i); }
};

Expression input(ComputationGraph& g, real s);
Expression input(ComputationGraph& g, const real *ps);
Expression input(ComputationGraph& g, const Dim& d, const std::vector<float>& data);
Expression input(ComputationGraph& g, const Dim& d, const std::vector<float>* pdata);
Expression parameter(ComputationGraph& g, Parameters* p);
Expression const_parameter(ComputationGraph& g, Parameters* p);
Expression lookup(ComputationGraph& g, LookupParameters* p, unsigned index);
Expression lookup(ComputationGraph& g, LookupParameters* p, const unsigned* pindex);
Expression const_lookup(ComputationGraph& g, LookupParameters* p, unsigned index);
Expression const_lookup(ComputationGraph& g, LookupParameters* p, const unsigned* pindex);
// Batched versions of lookup and const_lookup
Expression lookup(ComputationGraph& g, LookupParameters* p, const std::vector<unsigned>& indices);
Expression lookup(ComputationGraph& g, LookupParameters* p, const std::vector<unsigned>* pindices);
Expression const_lookup(ComputationGraph& g, LookupParameters* p, const std::vector<unsigned>& indices);
Expression const_lookup(ComputationGraph& g, LookupParameters* p, const std::vector<unsigned>* pindices);
Expression zeroes(ComputationGraph& g, const Dim& d);

Expression operator-(const Expression& x);
Expression operator+(const Expression& x, const Expression& y);
{'fraction_non_alphanumeric': 0.11357739982703949, 'fraction_numerical': 0.0, 'mean_word_length': 7.920308483290489, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, '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': '6012174', 'n_tokens_mistral': 988, 'n_tokens_neox': 983, 'n_words': 315}