mindchemistry.e3.nn.soft_one_hot_linspace
- mindchemistry.e3.nn.soft_one_hot_linspace(x, start, end, number, basis='smooth_finite', cutoff=True)[source]
- Projection on a basis of functions. Returns a set of \(\{y_i(x)\}_{i=1}^N\), \[y_i(x) = \frac{1}{Z} f_i(x)\]- where \(x\) is the input and \(f_i\) is the ith basis function. \(Z\) is a constant defined (if possible) such that, \[\langle \sum_{i=1}^N y_i(x)^2 \rangle_x \approx 1\]- Note that bessel basis cannot be normalized. - Parameters
- x (Tensor) – The shape of Tensor is \((...)\). 
- start (float) – minimum value span by the basis. 
- end (float) – maximum value span by the basis. 
- number (int) – number of basis functions \(N\). 
- basis (str) – {'gaussian', 'cosine', 'smooth_finite', 'fourier', 'bessel'}, the basis family. Default: - 'smooth_finite'.
- cutoff (bool) – whether require the \(y_i(x)\) from the outside domain of (start, end) to be vanished. Default: - True.
 
- Returns
- Tensor, shape is \((..., N)\). 
- Raises
- ValueError – If basis is not in {'gaussian', 'cosine', 'smooth_finite', 'fourier', 'bessel'}. 
 - Supported Platforms:
- Ascend
 - Examples - >>> from mindchemistry.e3.nn import soft_one_hot_linspace >>> from mindspore import ops, Tensor >>> x = Tensor(ops.ones((4, 6))) >>> outputs = soft_one_hot_linspace(x, -0.5, 1.5, number=4) >>> print(outputs.shape) (4, 6, 4)