mirror of https://github.com/tracel-ai/burn.git
Regex fix pytorch (#1196)
This commit is contained in:
parent
c92c51d8b9
commit
14aad24c19
|
@ -97,10 +97,10 @@ a working example of doing min-max normalization with cloning.
|
|||
let max = input.clone().max();
|
||||
let input = (input.clone() - min.clone()).div(max - min);
|
||||
println!("{:?}", input.to_data()); // Success: [0.0, 0.33333334, 0.6666667, 1.0]
|
||||
|
||||
|
||||
// Notice that max, min have been moved in last operation so the below print will give an error.
|
||||
// If we want to use them for further operations, they will need to be cloned in similar fashion.
|
||||
// println!("{:?}", min.to_data());
|
||||
// println!("{:?}", min.to_data());
|
||||
```
|
||||
|
||||
We don't need to be worried about memory overhead because with cloning, the tensor's buffer isn't copied,
|
||||
|
|
|
@ -110,7 +110,7 @@ impl LoadArgs {
|
|||
/// [Replacement](https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace) for the
|
||||
/// replacement syntax.
|
||||
pub fn with_key_remap(mut self, pattern: &str, replacement: &str) -> Self {
|
||||
let regex = Regex::new(&format!("^{}$", pattern)).unwrap();
|
||||
let regex = Regex::new(pattern).expect("Valid regex");
|
||||
|
||||
self.key_remap.push((regex, replacement.into()));
|
||||
self
|
||||
|
|
Loading…
Reference in New Issue