8c17debc9dc6552da8c317c0c852b55f03c80c61,slm_lab/experiment/monitor.py,DataSpace,add,#DataSpace#Any#,168

Before Change


        // note: store history in canonical a,e,b form
        self.data_proj = data_proj
        self.dual_data_proj = self.create_dual_data_proj(data_proj)
        if self.proj_axis == "a":
            self.data_proj_history.append(self.data_proj)
        else:
            self.data_proj_history.append(self.dual_data_proj)

    def get(self, a=None, e=None):
        """
        Get the data_proj for a or e axis to be used by agent_space, env_space respectively, automatically projected and resolved.
        @param {int} a The index a of an agent in agent_space

After Change


        @returns {array} data Tensor in standard aeb shape.
        """
        new_data = np.array(data_v)  // no type restriction, auto-infer
        if self.to_swap:  // data from env has shape eab
            self.swap_data = new_data
            self.data = new_data.swapaxes(0, 1)
        else:
            self.data = new_data
            self.swap_data = new_data.swapaxes(0, 1)
        self.data_history.append(self.data)
        return self.data

    def get(self, a=None, e=None):
        """
        Get the data projected on a or e axes for use by agent_space, env_space.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: kengz/SLM-Lab
Commit Name: 8c17debc9dc6552da8c317c0c852b55f03c80c61
Time: 2017-12-24
Author: kengzwl@gmail.com
File Name: slm_lab/experiment/monitor.py
Class Name: DataSpace
Method Name: add


Project Name: dmlc/gluon-nlp
Commit Name: 3c874575bf40e8b1fa2280371131a8f29ebb3e98
Time: 2020-07-28
Author: xshiab@connect.ust.hk
File Name: src/gluonnlp/models/mobilebert.py
Class Name: MobileBertModel
Method Name: hybrid_forward


Project Name: dmlc/gluon-nlp
Commit Name: 3c874575bf40e8b1fa2280371131a8f29ebb3e98
Time: 2020-07-28
Author: xshiab@connect.ust.hk
File Name: src/gluonnlp/models/roberta.py
Class Name: RobertaModel
Method Name: hybrid_forward