Set all elements of the tensor to be the give value. Args: x (float): a float value to be set to all elements. inplace: inplace flag Returns: this tensor
(self, x, inplace=True)
| 310 | return self.data.L1() |
| 311 | |
| 312 | def set_value(self, x, inplace=True): |
| 313 | '''Set all elements of the tensor to be the give value. |
| 314 | |
| 315 | Args: |
| 316 | x (float): a float value to be set to all elements. |
| 317 | inplace: inplace flag |
| 318 | |
| 319 | Returns: |
| 320 | this tensor |
| 321 | ''' |
| 322 | # assert type(x) == float, 'set value only accepts float input' |
| 323 | # if isinstance(x, float): |
| 324 | if not inplace: |
| 325 | # return new tensor filled with value |
| 326 | raise NotImplementedError |
| 327 | |
| 328 | self.data.SetFloatValue(float(x)) |
| 329 | return self |
| 330 | |
| 331 | def copy_from_numpy(self, np_array, offset=0): |
| 332 | ''' Copy the data from the numpy array. |
no outgoing calls
no test coverage detected