본문 바로가기

IT214

tensorflow Keras - not_equal, cast Test 기본형태tf.keras.backend.not_equaltf.keras.backend.not_equal(x, y)Returns:A bool tensor.- Element-wise inequality between two tensors.​​tf.keras.backend.casttf.keras.backend.cast(x, dtype)Returns:Keras tensor with dtype `dtype`.- Casts a tensor to a different dtype and returns it.with tf.Session() as sess: test_input1 = Input(shape=(1, )) test_equal = K.not_equal([1, 2, -1, -1, 4, 5], -1) tester = K.. 2019. 3. 13.
keras Masking Test Definition:Masks a sequence by using a mask value to skip timesteps.For each timestep in the input tensor (dimension #1 in the tensor), if all values in the input tensor at that timestep are equal to mask_value, then the timestep will be masked (skipped) in all downstream layers (as long as they support masking).​But, I want to know the real output from Masking that expected.​Below to see how th.. 2019. 3. 13.
the longest palindromic substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example 1:Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example 2:Input: "cbbd" Output: "bb"​Palindromic 이라는 것은 회기되는 단어를 이야기 한다. 예를들어 "토마토", "스위스" 와 같은 문장이다. 위 문제에서는 가장 긴 회기단어를 추출하라는 것이다. ​Python Solution:class Solution: def longestPalindrome(self, s: str) -> str:.. 2019. 3. 6.
Number of 1 Bits Write a function that takes an unsigned integer and return the number of '1' bits it has (also known as the Hamming weight). Example 1:Input: 00000000000000000000000000001011 Output: 3 Explanation: The input binary string 00000000000000000000000000001011 has a total of three '1' bits. Example 2:Input: 00000000000000000000000010000000 Output: 1 Explanation: The input binary string 000000000000000.. 2019. 1. 24.
반응형