TensorFlow လည်ပတ်မှုများ
- ထည့်ပါ။
- နုတ်
- များပြားသည်။
- ဝေ
- ရင်ပြင်
- ပြန်လည်ပုံဖော်ပါ။
Tensor ပေါင်းထည့်ခြင်း။
tensorA.add(tensorB) ကို အသုံးပြု၍ တင်းဆာနှစ်ခုကို သင်ထည့်နိုင်သည် ။
ဥပမာ
const tensorA = tf.tensor([[1, 2], [3, 4], [5, 6]]);
const tensorB = tf.tensor([[1,-1], [2,-2], [3,-3]]);
// Tensor Addition
const tensorNew = tensorA.add(tensorB);
// Result: [ [2, 1], [5, 2], [8, 3] ]
Tensor နုတ်ခြင်း။
tensorA.sub(tensorB) ကိုသုံးပြီး တင်းဆာနှစ်ခုကို နုတ်နိုင်ပါတယ် ။
ဥပမာ
const tensorA = tf.tensor([[1, 2], [3, 4], [5, 6]]);
const tensorB = tf.tensor([[1,-1], [2,-2], [3,-3]]);
// Tensor Subtraction
const tensorNew = tensorA.sub(tensorB);
// Result: [ [0, 3], [1, 6], [2, 9] ]
Tensor Multiplication
tensorA.mul(tensorB) ကို အသုံးပြု၍ တင်းဆာနှစ်ခုကို ပွားနိုင်သည် ။
ဥပမာ
const tensorA = tf.tensor([1, 2, 3, 4]);
const tensorB = tf.tensor([4, 4, 2, 2]);
// Tensor Multiplication
const tensorNew = tensorA.mul(tensorB);
// Result: [ 4, 8, 6, 8 ]
Tensor ဌာနခွဲ
tensorA.div(tensorB) ကို အသုံးပြု၍ တင်းဆာနှစ်ခုကို ပိုင်းခြားနိုင်ပါသည် ။
ဥပမာ
const tensorA = tf.tensor([[1, 2], [3, 4], [5, 6]]);
const tensorB = tf.tensor([[1,-1], [2,-2], [3,-3]]);
// Tensor Division
const tensorNew = tensorA.div(tensorB);
// Result: [ 2, 2, 3, 4 ]
Tensor Square
tensor.square() ကို အသုံးပြု၍ တင်းဆာတစ်ခုကို လေးထောင့်ပုံစံ ပြုလုပ်နိုင်သည် ။
ဥပမာ
const tensorA = tf.tensor([1, 2, 3, 4]);
// Tensor Square
const tensorNew = tensorA.square();
// Result [ 1, 4, 9, 16 ]
Tensor Reshape
တင်းဆာတစ်ခုရှိ ဒြပ်စင်အရေအတွက်သည် ပုံသဏ္ဍာန်ရှိ အရွယ်အစားများ၏ ရလဒ်ဖြစ်သည်။
တူညီသောအရွယ်အစားရှိ မတူညီသောပုံသဏ္ဍာန်များ ရှိနိုင်သောကြောင့် tensor ကို အရွယ်အစားတူ အခြားပုံသဏ္ဍာန်များအဖြစ် ပြောင်းလဲရန် မကြာခဏ အသုံးဝင်ပါသည်။
tensor.reshape() ကို အသုံးပြု၍ tensor ကို ပြန်လည်ပုံဖော်နိုင်သည် -
ဥပမာ
const tensorA = tf.tensor([[1, 2], [3, 4]]);
const tensorB = tensorA.reshape([4, 1]);
// Result: [ [1], [2], [3], [4] ]