This file is indexed.

/usr/include/torch/DataSet.h is in libtorch3-dev 3.1-2.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
// Copyright (C) 2003--2004 Ronan Collobert (collober@idiap.ch)
//                
// This file is part of Torch 3.1.
//
// All rights reserved.
// 
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
//    notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
//    notice, this list of conditions and the following disclaimer in the
//    documentation and/or other materials provided with the distribution.
// 3. The name of the author may not be used to endorse or promote products
//    derived from this software without specific prior written permission.
// 
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#ifndef DATA_SET_INC
#define DATA_SET_INC

#include "Object.h"
#include "Sequence.h"
#include "PreProcessing.h"
#include "Stack.h"

struct FrameSubsets
{
    int **subsets;
    int *subsets_sizes;
    int n_subsets;
    int n_selected_frames;
    int *selected_frames;
};

namespace Torch {

/** Provides an interface to manipulate all kind of data.
    A dataset contains two kind of things: inputs sequences
    and targets sequences.

    @author Ronan Collobert (collober@idiap.ch)
*/
class DataSet : public Object
{
  public:
    //--- internal ---
    int **subsets;
    int *n_examples_subsets;
    int n_subsets;
    Stack *pushed_examples;
    //----------------
    
    // True if a subset of the examples is selected.
    bool select_examples;

    /** The indices of all selected examples.
        When #select_examples# is false, it contains
        the indices of all examples.
    */
    int *selected_examples;

    /// Frame size of #inputs#.    
    int n_inputs;

    /// Frame size of #targets#.    
    int n_targets;

    /** Index of the current example.
        Warning: it's the \emph{real} index and not the index
        in the #selected_examples# table.
    */
    int real_current_example_index;

    /// Pointer on the inputs of the current example.
    Sequence *inputs;

    /// Pointer to the targets of the current example.
    Sequence *targets;

    /** Number of examples in the dataset.
        If you're using #select_examples#, it's
        the number of selected examples.
    */
    int n_examples;
    
    /** Real number of examples in the dataset.
        It's the number of examples in memory.
        (= #n_examples# if #select_examples# is false)
    */
    int n_real_examples;

    //-----

    ///
    DataSet();

    /** Method which initializes some fields of the datasets.
        It has to be called only in the constructor of your subclasses.
        Just for developpers of new datasets.
    */
    void init(int n_examples_, int n_inputs_, int n_targets_);

    /** Set #targets# and #inputs# to the targets and inputs
        of the example with the index #selected_examples[t]#.
        Warning: after a #setExample()# the previous selected example
        is \emph{not} supposed to exist... for that, use #pushExample()#.
    */
    void setExample(int t, bool set_inputs=true, bool set_targets=true);

    /** Set #targets# and #inputs# to the targets and inputs
        of the example with the index #t#. If you create a new
        dataset, you \emph{must} update inside #current_example_index#.
        Warning: after a #setExample()# the previous selected example
        is \emph{not} supposed to exist... for that, use #pushExample()#.
    */
    virtual void setRealExample(int t, bool set_inputs=true, bool set_targets=true) = 0;

    /** Set a new subset.
        \begin{itemize}
          \item #subset_# (of size #n_examples_#) is a set
          of indices which define a subset of #data#.
          \item if a #pushSubset()# has been already called,
          the next #pushSubset()# defines a subset of the
          previous subset, and so on...
          \item this function set #select_examples# to #true#
          and set the read indices of the examples in
          #selected_examples#.
        \end{itemize}
    */
    virtual void pushSubset(int *subset_, int n_examples_);

    /** Remove the last subset.
        \begin{itemize}
          \item recomputes "selected_examples".
          \item if it was the last subset, set #select_examples#
          to #false#.
        \end{itemize}
    */
    virtual void popSubset();

    /** Tells that the current example must be kept in memory
        after next calls of #setExample()#. */
    virtual void pushExample() = 0;

    /** Tells that the last pushed example will be now the current
        example, and therefore, will be forgeted after the next
        call of #setExample()#. */
    virtual void popExample() = 0;

    /** Put in #n_input_frames# and #n_target_frames# the number
        of input frames and target frames for example #t#.
        This take subsets in account.
        If one field is #NULL#, it will not be returned.
    */
    virtual void getNumberOfFrames(int t, int *n_input_frames, int *n_target_frames) = 0;

    /// Perform some pre-processing on data.
    virtual void preProcess(PreProcessing *pre_processing) = 0;

    //-----

    virtual ~DataSet();
};

}

#endif